]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
ebl_strtabfinalize: Don't SEGV when no strings are present
authorPetr Machata <pmachata@redhat.com>
Thu, 6 Aug 2009 16:45:08 +0000 (18:45 +0200)
committerUlrich Drepper <drepper@redhat.com>
Thu, 6 Aug 2009 17:18:09 +0000 (10:18 -0700)
(cherry picked from commit a3a81e8352571f8aa9721a8940fbe54543029958)

libebl/ChangeLog
libebl/eblstrtab.c

index 30ad7d8bad4ef90304fa5227e3561819341e211c..8c2f7df14ccf24a0b17dcb2f351706a1071459a5 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-06  Petr Machata  <pmachata@redhat.com>
+
+       * libebl/eblstrtab.c (ebl_strtabfinalize): Only call copystrings
+       if we have any strings to copy.
+
 2009-07-26  Mark Wielaard  <mjw@redhat.com>
 
        * eblobjnote.c (ebl_object_note): Handle NT_GNU_GOLD_VERSION.
index d6ce94aed2468ea25112f63f7bc7c15d38c7db3d..ae4e6af07628131046456a2095dffd5c45032ba8 100644 (file)
@@ -352,7 +352,8 @@ ebl_strtabfinalize (struct Ebl_Strtab *st, Elf_Data *data)
      the offset members of the elfstrent records.  */
   char *endp = (char *) data->d_buf + nulllen;
   size_t copylen = nulllen;
-  copystrings (st->root, &endp, &copylen);
+  if (st->root)
+    copystrings (st->root, &endp, &copylen);
   assert (copylen == st->total + nulllen);
 }