]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: reject negative values for scaled integer
authorPavel Hrdina <phrdina@redhat.com>
Fri, 22 May 2015 13:56:57 +0000 (15:56 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 25 May 2015 07:08:38 +0000 (09:08 +0200)
Some virsh commands have a size parameter, which is handled as scaled
integer.  We don't have any *feature* that would allow to use '-1' as
maximum size, so it's safe to reject any negative values for those
commands.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1159171

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
tools/virsh.c

index 4425774b3d657aeebbb97053310cccde34c43962..1005ba8316f455c51b7cb977b2ff6ecc8053c45e 100644 (file)
@@ -1811,7 +1811,7 @@ vshCommandOptScaledInt(const vshCmd *cmd, const char *name,
     ret = vshCommandOptString(cmd, name, &str);
     if (ret <= 0)
         return ret;
-    if (virStrToLong_ull(str, &end, 10, value) < 0 ||
+    if (virStrToLong_ullp(str, &end, 10, value) < 0 ||
         virScaleInteger(value, end, scale, max) < 0)
         return -1;
     return 1;