append the terminating '\0' to bootorder string
authorAmos Kong <akong@redhat.com>
Wed, 20 Mar 2013 10:16:34 +0000 (18:16 +0800)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 2 Apr 2013 13:13:22 +0000 (08:13 -0500)
Problem was introduced in commit c8a6ae8b. The last terminating
'\0' was lost, use the right length 5 ("HALT\0").

Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Message-id: 1363774594-21001-1-git-send-email-akong@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vl.c

diff --git a/vl.c b/vl.c
index 52eacca..e2c9706 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1278,9 +1278,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;
 }