direct-io.hg

changeset 11259:5b9ff5e8653a

[PATCH] 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

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---
author Alex Williamson <alex.williamson@hp.com>
date Sun Aug 27 06:56:01 2006 +0100 (2006-08-27)
parents 1a3b883614b7
children fab84f9c0ce6 c4ea8d4d2ae1
files tools/libxc/xc_load_elf.c xen/common/elf.c
line diff
     1.1 --- a/tools/libxc/xc_load_elf.c	Fri Aug 25 22:35:24 2006 +0100
     1.2 +++ b/tools/libxc/xc_load_elf.c	Sun Aug 27 06:56:01 2006 +0100
     1.3 @@ -93,6 +93,9 @@ static const char *xen_guest_lookup(stru
     1.4      const char *fallback;
     1.5      const char *p;
     1.6  
     1.7 +    if ( !dsi->__xen_guest_string )
     1.8 +        return NULL;
     1.9 +
    1.10      if ( type > sizeof(xenguest_fallbacks) )
    1.11          return NULL;
    1.12  
     2.1 --- a/xen/common/elf.c	Fri Aug 25 22:35:24 2006 +0100
     2.2 +++ b/xen/common/elf.c	Sun Aug 27 06:56:01 2006 +0100
     2.3 @@ -49,6 +49,9 @@ static const char *xen_guest_lookup(stru
     2.4      const char *fallback;
     2.5      const char *p;
     2.6  
     2.7 +    if ( !dsi->__xen_guest_string )
     2.8 +        return NULL;
     2.9 +
    2.10      if ( type > sizeof(xenguest_fallbacks) )
    2.11          return NULL;
    2.12