From nobody Mon Feb 9 16:34:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614698496; cv=none; d=zohomail.com; s=zohoarc; b=QcfxVAOya1pbqigDg2GCv+YcveZRyij6GiKPiXjqybRtYjbCrjsrGEQxk/4GCgl3JBws5HH/zzgE8xFUOuH6eB/TQlb1LngM1AaqT/Enomg6n41fFCKPXXdHKxbGieE5p+lL/xkqQ8v2StywlGcTzvb+8sesz17k6azl/g+/5vk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614698496; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yf7smPdyyBn+SquYvTEVCHrXl0tmZwLYJqdrCJ3w9EE=; b=dlzmVeNadWyulreWFxD7VuNKlrYfoScKmxUJqwKqkkLe/NY6v5QHEQDCFh4tnOaq8jRpX68AS/rnPBk4iC1x6DzoyWWodfs979IJIktVTY3Is5Jv2iO6ur5db9SYmx0+GNrWVZUj8YoK6z3RQL26dsRVU2ZFX5gVWgDFETfTaqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614698496336824.0066272791535; Tue, 2 Mar 2021 07:21:36 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-D4lTaE5KODWrDctFMFtamQ-1; Tue, 02 Mar 2021 10:21:32 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01EBF1936B68; Tue, 2 Mar 2021 15:21:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB1D960C05; Tue, 2 Mar 2021 15:21:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 754AD57DFC; Tue, 2 Mar 2021 15:21:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 122FLHcV017541 for ; Tue, 2 Mar 2021 10:21:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 576F31A7D9; Tue, 2 Mar 2021 15:21:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id B64ED19C48 for ; Tue, 2 Mar 2021 15:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614698495; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yf7smPdyyBn+SquYvTEVCHrXl0tmZwLYJqdrCJ3w9EE=; b=i6hALz9zFaUdIiC3HjuN1DdchjU5o/4TY5u/jT/zNlUotVSqAVfizhyQZvhThFfDLxksfr rTLzQAE7dp2LqgHNhy0a9tCokKPoF56I8f+AT54rQ0P/bLAUK6cc5NuWW0Vus6Zv5DHJ5D NdmbAIymv58c5FAQXgOYqJ5LViV6rA8= X-MC-Unique: D4lTaE5KODWrDctFMFtamQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] util: virprocess: Use local maximum error message size Date: Tue, 2 Mar 2021 16:21:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use of VIR_ERROR_MAX_LENGTH is actually misleading to the readers because it implies that the strings in virError are 1024 bytes at most. That isn't true at least for the 'message' field as it's constructed from concatenating the detail string which (was) max 1024 bytes with the string variant of the error code without limiting to 1024. Use a local copy for declaring the struct for error transport with a comment so that's obvious that it's a local decision to use 1k buffers. Signed-off-by: Peter Krempa --- src/util/virprocess.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 69d64e9466..5a4e3c3e43 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -1137,14 +1137,16 @@ virProcessRunInMountNamespace(pid_t pid G_GNUC_UNUS= ED, #ifndef WIN32 +/* We assume that error messages will fit into 1024 chars */ +# define VIR_PROCESS_ERROR_MAX_LENGTH 1024 typedef struct { int code; int domain; - char message[VIR_ERROR_MAX_LENGTH]; + char message[VIR_PROCESS_ERROR_MAX_LENGTH]; virErrorLevel level; - char str1[VIR_ERROR_MAX_LENGTH]; - char str2[VIR_ERROR_MAX_LENGTH]; - char str3[VIR_ERROR_MAX_LENGTH]; + char str1[VIR_PROCESS_ERROR_MAX_LENGTH]; + char str2[VIR_PROCESS_ERROR_MAX_LENGTH]; + char str3[VIR_PROCESS_ERROR_MAX_LENGTH]; int int1; int int2; } errorData; --=20 2.29.2