From nobody Sun Feb 8 23:41:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1666621035; cv=none; d=zohomail.com; s=zohoarc; b=MPuov9IIfG7jq7ysyPX+wlpgDvasU5aJ5jttPy6NcQr9et8DB9I/aPDpntNoxZBaFyuUkrzcVM1J0xo1P8ehiUPaopeJ7HhDAu3qBrgsnQcuD0YC2PObVeVE3tFIB+DEn8frPhoqsoEKpwiM22ynr5OJBEcG8IGD/CbJf+hveqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666621035; 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=nOx1tibVApG6Yt8lSpaMGMhEfUvQj210j0q3aTLeVD0=; b=MfMmCUeiPlmffX7pJ37BDq0OdBj70R7ztQ64kPZdeX77+fLEbL4YeD4emIw5imGz31r3hhAg2rG/cL8xUhBHPcvT7VmOdIoqXYN4RwzZZH27+ssFVU2zrcVnqHmVcZ0fWOreRrEJti5qSvb79F2My1lg2r6L9TBi8wzvc0AQ+Vk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1666621035242408.86221086335684; Mon, 24 Oct 2022 07:17:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-Za9aRvDzM3yQMQJr17PyXQ-1; Mon, 24 Oct 2022 10:16:06 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFC3E83FC85; Mon, 24 Oct 2022 14:15:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A30A0C15BB2; Mon, 24 Oct 2022 14:15:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9311719465B2; Mon, 24 Oct 2022 14:15:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A46F519465B2 for ; Mon, 24 Oct 2022 14:15:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 95E8240C2140; Mon, 24 Oct 2022 14:15:24 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-27.brq.redhat.com [10.40.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1E9F40C2064 for ; Mon, 24 Oct 2022 14:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666621033; 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=nOx1tibVApG6Yt8lSpaMGMhEfUvQj210j0q3aTLeVD0=; b=HVoGsAI18BL8Y1qxPzU2PZSfF6+nJ2aDUbttdWzd8rv3Fy8OTp1zxoIvHTNTsnkiCqUM6F CMHFYp2UvtktkmYWinD+bSCajwRcbGGubKgAXBkhp0DMTDJeY1Syko8ThffMboKu+oRGJG EM9Ty5nexEcXZxvoUZEY9nYJ4CkcECs= X-MC-Unique: Za9aRvDzM3yQMQJr17PyXQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 21/43] util: xml: Disallow aliasing of negative numbers in virXPathUInt Date: Mon, 24 Oct 2022 16:14:26 +0200 Message-Id: <80443f9d91cad1b4cfdad0dbc4a8b9b5609de6f0.1666619795.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666621037008100007 Content-Type: text/plain; charset="utf-8" Passing negative number as an alias for the max value is an anti-feature we unfortunately allowed in virsh, but luckily never encouraged in the XML. Refuse numbers with negative sign when parsing unsigned int from XPaths. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virxml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virxml.c b/src/util/virxml.c index a47a5d49fc..d80a69f163 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -253,7 +253,7 @@ virXPathUIntBase(const char *xpath, if (!(obj =3D virXPathEvalString(xpath, ctxt))) return -1; - if (virStrToLong_ui((char *) obj->stringval, NULL, base, value) < 0) + if (virStrToLong_uip((char *) obj->stringval, NULL, base, value) < 0) return -2; return 0; --=20 2.37.3