From 5f1399651eaab1b04e49107250d182968a227aa6 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Mon, 4 Feb 2013 16:27:50 -0200 Subject: vl.c: Use parse_uint_full() for NUMA nodeid This should catch many kinds of errors that the current code wasn't checking for: - Values that can't be parsed as a number - Negative values - Overflow - Empty string Signed-off-by: Eduardo Habkost Reviewed-by: Eric Blake Signed-off-by: Anthony Liguori --- vl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 4955c2972d..d6f6422de4 100644 --- a/vl.c +++ b/vl.c @@ -1267,7 +1267,10 @@ static void numa_add(const char *optarg) if (get_param_value(option, 128, "nodeid", optarg) == 0) { nodenr = nb_numa_nodes; } else { - nodenr = strtoull(option, NULL, 10); + if (parse_uint_full(option, &nodenr, 10) < 0) { + fprintf(stderr, "qemu: Invalid NUMA nodeid: %s\n", option); + exit(1); + } } if (nodenr >= MAX_NODES) { -- cgit v1.2.3