svn commit: r231703 - stable/8/lib/libelf
    Kai Wang 
    kaiw at FreeBSD.org
       
    Tue Feb 14 19:48:57 UTC 2012
    
    
  
Author: kaiw
Date: Tue Feb 14 19:48:57 2012
New Revision: 231703
URL: http://svn.freebsd.org/changeset/base/231703
Log:
  MFC r221595:
  
  For zero-sized sections, set the `d_buf` field of the `Elf_Data`
  descriptor returned by `elf_rawdata()` to NULL.
Modified:
  stable/8/lib/libelf/elf_data.c
Directory Properties:
  stable/8/lib/libelf/   (props changed)
Modified: stable/8/lib/libelf/elf_data.c
==============================================================================
--- stable/8/lib/libelf/elf_data.c	Tue Feb 14 19:36:35 2012	(r231702)
+++ stable/8/lib/libelf/elf_data.c	Tue Feb 14 19:48:57 2012	(r231703)
@@ -223,7 +223,8 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d)
 	if ((d = _libelf_allocate_data(s)) == NULL)
 		return (NULL);
 
-	d->d_buf     = sh_type == SHT_NOBITS ? NULL : e->e_rawfile + sh_offset;
+	d->d_buf     = (sh_type == SHT_NOBITS || sh_size == 0) ? NULL :
+	    e->e_rawfile + sh_offset;
 	d->d_off     = 0;
 	d->d_align   = sh_align;
 	d->d_size    = sh_size;
    
    
More information about the svn-src-stable-8
mailing list