[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxl: fix off-by-one error in JSON parser



commit 1391ca3bfa6555deefa3df620e1aa824652329f5
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Feb 25 14:56:00 2015 +0000
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Mon Mar 2 17:05:02 2015 +0000

    libxl: fix off-by-one error in JSON parser
    
    We need a sentinel slot in the generated libxl_key_value_list.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl_json.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
index ceb014a..98335b0 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -247,7 +247,7 @@ int libxl__key_value_list_parse_json(libxl__gc *gc, const 
libxl__json_object *o,
 
     maps = libxl__json_object_get_map(o);
     size = maps->count * 2;
-    kvl = *p = libxl__calloc(NOGC, size, sizeof(char *));
+    kvl = *p = libxl__calloc(NOGC, size+1, sizeof(char *));
 
     for (i = 0; i < maps->count; i++) {
         int idx = i * 2;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.