qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] qemu-option: reject empty number value


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH] qemu-option: reject empty number value
Date: Mon, 6 Feb 2017 17:28:35 +0400

When no number is provided, return an invalid number error.
(note: this may break some users relying on default 0 value)

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1417864

Signed-off-by: Marc-André Lureau <address@hidden>
---
 util/qemu-option.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/qemu-option.c b/util/qemu-option.c
index 3467dc2397..89afa4b2c3 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -150,7 +150,7 @@ static void parse_option_number(const char *name, const 
char *value,
 
     if (value != NULL) {
         number = strtoull(value, &postfix, 0);
-        if (*postfix != '\0') {
+        if (*postfix != '\0' || postfix == value) {
             error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
             return;
         }
-- 
2.11.0.295.gd7dffce1c.dirty




reply via email to

[Prev in Thread] Current Thread [Next in Thread]