Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2012 19:48:57 +0000 (UTC)
From:      Kai Wang <kaiw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r231703 - stable/8/lib/libelf
Message-ID:  <201202141948.q1EJmv0L015134@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202141948.q1EJmv0L015134>