From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIG5L-0006Gu-Sa for qemu-devel@nongnu.org; Wed, 20 Mar 2013 06:17:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIG5J-0002mc-It for qemu-devel@nongnu.org; Wed, 20 Mar 2013 06:17:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIG5J-0002mJ-BN for qemu-devel@nongnu.org; Wed, 20 Mar 2013 06:17:29 -0400 From: Amos Kong Date: Wed, 20 Mar 2013 18:16:34 +0800 Message-Id: <1363774594-21001-1-git-send-email-akong@redhat.com> Subject: [Qemu-devel] [PATCH] append the terminating '\0' to bootorder string List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com, qemu-devel@nongnu.org Cc: kraxel@redhat.com Problem was introduced in commit c8a6ae8b. The last terminating '\0' was lost, use the right length 5 ("HALT\0"). Reported-by: Gerd Hoffmann Signed-off-by: Amos Kong --- vl.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index aeed7f4..d3172ea 100644 --- a/vl.c +++ b/vl.c @@ -1273,9 +1273,9 @@ char *get_boot_devices_list(size_t *size) if (boot_strict && *size > 0) { list[total-1] = '\n'; - list = g_realloc(list, total + 4); - memcpy(&list[total], "HALT", 4); - *size = total + 4; + list = g_realloc(list, total + 5); + memcpy(&list[total], "HALT", 5); + *size = total + 5; } return list; } -- 1.7.1