From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttj6y-0001U1-W4 for qemu-devel@nongnu.org; Fri, 11 Jan 2013 13:13:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttj6q-00032o-Tz for qemu-devel@nongnu.org; Fri, 11 Jan 2013 13:13:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttj6q-00032P-Mp for qemu-devel@nongnu.org; Fri, 11 Jan 2013 13:13:40 -0500 From: Eduardo Habkost Date: Fri, 11 Jan 2013 16:15:05 -0200 Message-Id: <1357928108-21066-8-git-send-email-ehabkost@redhat.com> In-Reply-To: <1357928108-21066-1-git-send-email-ehabkost@redhat.com> References: <1357928108-21066-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 07/10] vl.c: numa_add_node(): Validate nodeid before using it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: libvir-list@redhat.com, Chegu Vinod , Anthony Liguori Without this check, qemu-kvm will corrupt memory if a too-large nodeid is provided in the command-line. e.g.: -numa node,mem=...,cpus=...,nodeid=65 Signed-off-by: Eduardo Habkost --- vl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vl.c b/vl.c index 19010fa..31175f6 100644 --- a/vl.c +++ b/vl.c @@ -1112,6 +1112,11 @@ static void numa_node_add(const char *optarg) nodenr = strtoull(option, NULL, 10); } + if (nodenr >= MAX_NODES) { + fprintf(stderr, "qemu: invalid NUMA nodeid: %d\n", nodenr); + exit(1); + } + if (get_param_value(option, 128, "mem", optarg) == 0) { node_mem[nodenr] = 0; } else { -- 1.7.11.7