From: Peter Krempa Date: Wed, 5 Oct 2022 07:56:38 +0000 (+0200) Subject: util: xml: Disallow aliasing of negative numbers in virXPathUInt X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3e3c52f10f894b049e0b72ee68233e2bba5a2b28;p=libvirt.git util: xml: Disallow aliasing of negative numbers in virXPathUInt 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án Tomko --- 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 = 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;