From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: [PATCH] fix null pointer dereference in xen_guest_lookup() Date: Sat, 26 Aug 2006 16:22:26 -0600 Message-ID: <1156630946.8431.8.camel@lappy> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser , Ian Campbell Cc: xen-devel List-Id: xen-devel@lists.xenproject.org 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 --- diff -r 2bc5796fbfcc tools/libxc/xc_load_elf.c --- a/tools/libxc/xc_load_elf.c Sat Aug 26 14:44:47 2006 -0600 +++ b/tools/libxc/xc_load_elf.c Sat Aug 26 16:13:10 2006 -0600 @@ -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; diff -r 2bc5796fbfcc xen/common/elf.c --- a/xen/common/elf.c Sat Aug 26 14:44:47 2006 -0600 +++ b/xen/common/elf.c Sat Aug 26 16:13:10 2006 -0600 @@ -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;