diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2013-02-04 16:27:50 -0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-02-04 14:38:34 -0600 |
commit | 5f1399651eaab1b04e49107250d182968a227aa6 (patch) | |
tree | 3c5714c5278d7fd4fb88045fc653020eed1bc39b | |
parent | e4ce85b25838694d2d7396b5e969eb4830329631 (diff) | |
download | qemu-5f1399651eaab1b04e49107250d182968a227aa6.zip qemu-5f1399651eaab1b04e49107250d182968a227aa6.tar.gz qemu-5f1399651eaab1b04e49107250d182968a227aa6.tar.bz2 |
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 <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | vl.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) { |