[PATCH 12/43] util: xml: Disallow aliasing of negative numbers in virXPathULongLong

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pkrempa@xxxxxxxxxx>
---
 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 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;
-- 
2.37.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux