summary refs log tree commit diff stats
path: root/monitor.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2018-11-21 17:44:14 +0100
committerMarkus Armbruster <armbru@redhat.com>2018-12-13 19:10:06 +0100
commitaf02f4c5179675ad4e26b17ba26694a8fcde17fa (patch)
tree7b316a4e89c962284f479f604f4b2515b4cc4f97 /monitor.c
parentca28f5481607e5c59481e70e429f5dd23662cb69 (diff)
downloadfocaccia-qemu-af02f4c5179675ad4e26b17ba26694a8fcde17fa.tar.gz
focaccia-qemu-af02f4c5179675ad4e26b17ba26694a8fcde17fa.zip
cutils: Fix qemu_strtosz() & friends to reject non-finite sizes
qemu_strtosz() & friends reject NaNs, but happily accept infinities.
They shouldn't. Fix that.

The fix makes use of qemu_strtod_finite(). To avoid ugly casts,
change the @end parameter of qemu_strtosz() & friends from char **
to const char **.

Also, add two test cases, testing that "inf" and "NaN" are properly
rejected. While at it, also fixup the function documentation.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-3-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/monitor.c b/monitor.c
index 6e81b09294..cf9cece965 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3232,7 +3232,7 @@ static QDict *monitor_parse_arguments(Monitor *mon,
             {
                 int ret;
                 uint64_t val;
-                char *end;
+                const char *end;
 
                 while (qemu_isspace(*p)) {
                     p++;