From: Peter Krempa Date: Wed, 5 Oct 2022 07:56:38 +0000 (+0200) Subject: util: xml: Disallow aliasing of negative numbers in virXPathULongLong X-Git-Tag: v8.10.0-rc1~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8ea7ac57942d3aca1d65e5deb9f21b82a5e8741;p=thirdparty%2Flibvirt.git util: xml: Disallow aliasing of negative numbers in virXPathULongLong 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 long long 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 35c0340779..067fef8856 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -323,7 +323,7 @@ virXPathULongLong(const char *xpath, if (!(obj = virXPathEvalString(xpath, ctxt))) return -1; - if (virStrToLong_ull((char *) obj->stringval, NULL, 10, value) < 0) + if (virStrToLong_ullp((char *) obj->stringval, NULL, 10, value) < 0) return -2; return 0;