From nobody Sat May 30 15:30:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1779120564; cv=none; d=zohomail.com; s=zohoarc; b=F8PWL7v6bEdfMUtobXkucGn1ZnW+QTs2YwQffIYBDHo0nnGcVjKHLElR9T7n3b3DUklaLPYWvvWhK4NvkrNNgCvpuKnLGoHkQkzR3oojSDbRXowvZHhkRHZ5D0Cj+joA4QmMsEPI3ZSis/5xKwuXizOO6QPDuUCzOTULBeKLvak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779120564; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=mywtwkpEGEMBIRqNbgEU+XoK5cXqweIgcQ4+RueSnsE=; b=ngpyAjOkU6sdLUYGoYix+uxIxhubc5GGUlGdhnNCyB8tER0j/k1Gk/nNoT1zCxv4S7faI8lI1HEHNK6gu2bNXVtZl5dO2JhKNGVExOQU4jvuEuPEedGTJYSexfBd+ODSxYvTmac0NKOXQZKezcYDkWJdeKXW76Hlckw5CdVkB1Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 177912056442564.39473847978752; Mon, 18 May 2026 09:09:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 30E743F33D; Mon, 18 May 2026 12:09:23 -0400 (EDT) Received: from [172.19.199.5] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id B120541DCF; Mon, 18 May 2026 12:07:52 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 90ED5418FE; Mon, 18 May 2026 12:07:41 -0400 (EDT) Received: from mx11.osci.io (polly.osci.io [IPv6:2620:52:6:3141:1::41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2EBB141E26 for ; Mon, 18 May 2026 12:01:33 -0400 (EDT) Received: by mx11.osci.io (Postfix, from userid 994) id 1B9D864919; Sat, 16 May 2026 04:12:53 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mx11.osci.io (Postfix) with ESMTPS id 7FA5764E08 for ; Sat, 16 May 2026 04:12:51 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-245-xc4ph-TGN6SGX9g4KqYaWQ-1; Sat, 16 May 2026 03:55:29 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6F8C91956089 for ; Sat, 16 May 2026 07:55:28 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.44.22.8]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B64E18001E8 for ; Sat, 16 May 2026 07:55:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 X-Greylist: delayed 580 seconds by postgrey-1.37 at polly.osci.io; Sat, 16 May 2026 04:12:51 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778919037; h=from:from: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; bh=mywtwkpEGEMBIRqNbgEU+XoK5cXqweIgcQ4+RueSnsE=; b=J+qd0bu/w4hLG7Mspe00PTs5SvTzyhsX4n72WriYZt4hCxGrwCgcfJX8jjmMRWQOpoWlI8 VWts21rCO7ofUZmLUOYxtvifOo8sSlG18knMQSrT2Uuy44xrjq8/JERdwfiHp4w0HVtr/4 A4ihgiZBlOJFijSJOQUmYyaAe+INMLc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778919170; h=from:from: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; bh=mywtwkpEGEMBIRqNbgEU+XoK5cXqweIgcQ4+RueSnsE=; b=coveAdGWUQcdnj/Ivps+rN84AbEW6uo9Dpf8j+PxqbaRE+ZpFAs2S5hR/ik76trDMHLBsj tYVzKzuH5/FES3OaEBPudOKnXxwTzgbLTRdAFUfXk3SEPVqWRqrIE/P6jw0yIsWrgdd1zk vR4UKAQa93j7fQr0EQDxerha6Y+WuVA= X-MC-Unique: xc4ph-TGN6SGX9g4KqYaWQ-1 X-Mimecast-MFC-AGG-ID: xc4ph-TGN6SGX9g4KqYaWQ_1778918128 To: devel@lists.libvirt.org Subject: [PATCH] virTypedParamsValidateTemplate: Fix counting of templates Date: Sat, 16 May 2026 09:55:26 +0200 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: -sPmwKTCv6l7zl_LZqIansAwQl_XFumyQ3dYHBvDyEM_1778918128 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5AHZPW2U4FAOIQNW7GSGQ6I2CEOKVHW5 X-Message-ID-Hash: 5AHZPW2U4FAOIQNW7GSGQ6I2CEOKVHW5 X-MailFrom: SRS0=0UN/=DN=redhat.com=pkrempa@osci.io X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZM-MESSAGEID: 1779120569804154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa There are 2 bugs in virTypedParamsValidateTemplate's counting of the passed amount of templates: - the condition looked for empty strings rather than non-empty ones - the count was 1 more than the amount of templates due to use of post-increment directly in the condition Fixes: 45617351585caa2c5bcc51af48bd32fd750e7afd Closes: https://gitlab.com/libvirt/libvirt/-/work_items/880 Signed-off-by: Peter Krempa Reviewed-by: Jiri Denemark --- src/util/virtypedparam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 92f25cea39..bca7478109 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -213,8 +213,8 @@ virTypedParamsValidateTemplate(virTypedParameterPtr par= ams, /* we need to copy the list of templates because * 'virTypedParamsValidateInternal' will need to sort it */ - while (*templates[ntemplates++].name =3D=3D '\0') - ; + while (*templates[ntemplates].name !=3D '\0') + ntemplates++; templ_copy =3D g_new0(virTypedParamValidationTemplate, ntemplates); memcpy(templ_copy, templates, sizeof(*templates) * ntemplates); --=20 2.54.0