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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to