From: Pavel Hrdina Date: Fri, 22 May 2015 13:56:57 +0000 (+0200) Subject: virsh: reject negative values for scaled integer X-Git-Tag: v1.2.16-rc1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=739ea3ce783e2ffbf6699b82f6020b613fef5f44;p=thirdparty%2Flibvirt.git virsh: reject negative values for scaled integer 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 --- diff --git a/tools/virsh.c b/tools/virsh.c index 4425774b3d..1005ba8316 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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;