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

[Xen-changelog] [xen master] libxl: fix libxl_string_list_length and its only caller



commit b0be2b126ea75a83a3778b4e1710d248f92cf528
Author:     Matthew Daley <mattjd@xxxxxxxxx>
AuthorDate: Wed Sep 18 15:37:40 2013 +1200
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Sep 25 12:42:02 2013 +0100

    libxl: fix libxl_string_list_length and its only caller
    
    The wrong amount of indirections were being taken in
    libxl_string_list_length, and its only caller was miscounting the amount
    of initial non-list arguments, seemingly since the initial commit
    (599c784).
    
    This has been seen and reported in the wild (##xen):
    < Trixboxer> Hi, any idea why would I get
    < Trixboxer> xl: libxl_bootloader.c:42: bootloader_arg: Assertion 
`bl->nargs < bl->argsspace' failed.
    < Trixboxer> 4.2.2-23.el6
    
    Coverity-ID: 1054954
    Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl.c            |    2 +-
 tools/libxl/libxl_bootloader.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 0879f23..ca24ca3 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -202,7 +202,7 @@ int libxl_string_list_length(const libxl_string_list *psl)
 {
     if (!psl) return 0;
     int i = 0;
-    while (*psl++) i++;
+    while ((*psl)[i]) i++;
     return i;
 }
 
diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
index ed12b2c..3287bf7 100644
--- a/tools/libxl/libxl_bootloader.c
+++ b/tools/libxl/libxl_bootloader.c
@@ -48,7 +48,7 @@ static void make_bootloader_args(libxl__gc *gc, 
libxl__bootloader_state *bl,
 {
     const libxl_domain_build_info *info = bl->info;
 
-    bl->argsspace = 7 + libxl_string_list_length(&info->u.pv.bootloader_args);
+    bl->argsspace = 9 + libxl_string_list_length(&info->u.pv.bootloader_args);
 
     GCNEW_ARRAY(bl->args, bl->argsspace);
 
--
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®.