From af02f4c5179675ad4e26b17ba26694a8fcde17fa Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Wed, 21 Nov 2018 17:44:14 +0100 Subject: 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 Reviewed-by: Markus Armbruster Signed-off-by: David Hildenbrand Message-Id: <20181121164421.20780-3-david@redhat.com> Signed-off-by: Markus Armbruster --- monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'monitor.c') 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++; -- cgit 1.4.1