From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSlzX-0006Ai-Sc for qemu-devel@nongnu.org; Tue, 22 Nov 2011 03:46:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSlzW-00007s-VU for qemu-devel@nongnu.org; Tue, 22 Nov 2011 03:46:11 -0500 Received: from oxygen.pond.sub.org ([78.46.104.156]:53674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSlzW-00007N-Lo for qemu-devel@nongnu.org; Tue, 22 Nov 2011 03:46:10 -0500 Received: from blackfin.pond.sub.org (p5B32D94C.dip.t-dialin.net [91.50.217.76]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 998B0A246D for ; Tue, 22 Nov 2011 09:46:07 +0100 (CET) From: Markus Armbruster Date: Tue, 22 Nov 2011 09:46:02 +0100 Message-Id: <1321951566-11667-3-git-send-email-armbru@redhat.com> In-Reply-To: <1321951566-11667-1-git-send-email-armbru@redhat.com> References: <1321951566-11667-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 2/6] vl: Tighten parsing of -numa's parameter mem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jes.Sorensen@redhat.com strtosz_suffix() fails unless the size is followed by 0, whitespace or ','. Useless here, because we need to fail for any junk following the size, even if it starts with whitespace or ','. Check manually. Things like -smp 4 -numa "node,mem=1024,cpus=0-1" -numa "node,mem=1024 cpus=2-3" are now caught. Before, the second -numa's argument was silently interpreted as just "node,mem=1024". Signed-off-by: Markus Armbruster --- vl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index f5afed4..b9146cf 100644 --- a/vl.c +++ b/vl.c @@ -953,8 +953,8 @@ static void numa_add(const char *optarg) node_mem[nodenr] = 0; } else { int64_t sval; - sval = strtosz(option, NULL); - if (sval < 0) { + sval = strtosz(option, &endptr); + if (sval < 0 || *endptr) { fprintf(stderr, "qemu: invalid numa mem size: %s\n", optarg); exit(1); } -- 1.7.6.4