Skip to contentSkip to conversation

fix null pointer dereference in xen_guest_lookup()

PATCH In review Alex Williamson 2 participants 2 messages Aug 26, 2006 – Aug 27, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix null pointer dereference in xen_guest_lookup()

The latest ELF changes have a null pointer dereference bug when you
have neither an elf notes section nor a __xen_guest_string. This patch checks for the existence of the __xen_guest_string prior to using it. Please apply. Thanks,

Alex

---

tools/libxc/xc_load_elf.c +3 -0
diff -r 2bc5796fbfcc tools/libxc/xc_load_elf.c
@@ -93,6 +93,9 @@ static const char *xen_guest_lookup(stru
     const char *fallback;
     const char *p;
 
+    if ( !dsi->__xen_guest_string )
+        return NULL;
+
     if ( type > sizeof(xenguest_fallbacks) )
         return NULL;
 
xen/common/elf.c +3 -0
diff -r 2bc5796fbfcc xen/common/elf.c
@@ -49,6 +49,9 @@ static const char *xen_guest_lookup(stru
     const char *fallback;
     const char *p;
 
+    if ( !dsi->__xen_guest_string )
+        return NULL;
+
     if ( type > sizeof(xenguest_fallbacks) )
         return NULL;
#1 lore raw
Quoted 4 lines · Alex Williamson

The latest ELF changes have a null pointer dereference bug when you
have neither an elf notes section nor a __xen_guest_string. This patch checks for the existence of the __xen_guest_string prior to using it. Please apply. Thanks,

Committed, thank you.

Ian.