|
|
9ae3a8 |
From 8fde4e2c8a03832087c7e006e35988245f55c57b Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 3 Nov 2017 18:06:12 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 2/2] qemu-option: reject empty number value
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20171103180612.24523-1-marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 77500
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v2] qemu-option: reject empty number value
|
|
|
9ae3a8 |
Bugzilla: 1417864
|
|
|
9ae3a8 |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
(Upstream commit to fix this bug is
|
|
|
9ae3a8 |
3403e5eb884f3a74c40fe7cccc103f848c040215, however, the patch relies on
|
|
|
9ae3a8 |
qemu_strtou64() which was introduced later and had several iterations)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
v2:
|
|
|
9ae3a8 |
- add errno check (Laszlo Ersek)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
util/qemu-option.c | 3 ++-
|
|
|
9ae3a8 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
util/qemu-option.c | 3 ++-
|
|
|
9ae3a8 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/util/qemu-option.c b/util/qemu-option.c
|
|
|
9ae3a8 |
index 4de5d13..5a85abd 100644
|
|
|
9ae3a8 |
--- a/util/qemu-option.c
|
|
|
9ae3a8 |
+++ b/util/qemu-option.c
|
|
|
9ae3a8 |
@@ -162,8 +162,9 @@ static void parse_option_number(const char *name, const char *value,
|
|
|
9ae3a8 |
uint64_t number;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (value != NULL) {
|
|
|
9ae3a8 |
+ errno = 0;
|
|
|
9ae3a8 |
number = strtoull(value, &postfix, 0);
|
|
|
9ae3a8 |
- if (*postfix != '\0') {
|
|
|
9ae3a8 |
+ if (errno != 0 || *postfix != '\0' || postfix == value) {
|
|
|
9ae3a8 |
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|