Patchwork append the terminating '\0' to bootorder string

login
register
mail settings
Submitter Amos Kong
Date March 20, 2013, 10:16 a.m.
Message ID <1363774594-21001-1-git-send-email-akong@redhat.com>
Download mbox | patch
Permalink /patch/229309/
State New
Headers show

Comments

Amos Kong - March 20, 2013, 10:16 a.m.
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>
---
 vl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Gerd Hoffmann - April 2, 2013, 8:50 a.m.
On 03/20/13 11:16, Amos Kong wrote:
> Problem was introduced in commit c8a6ae8b. The last terminating
> '\0' was lost, use the right length 5 ("HALT\0").

Acked-by: Gerd Hoffmann <kraxel@redhat.com>

cheers,
  Gerd
Anthony Liguori - April 2, 2013, 8:21 p.m.
Applied.  Thanks.

Regards,

Anthony Liguori

Patch

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;
 }