From: Petr Machata Date: Thu, 6 Aug 2009 16:45:08 +0000 (+0200) Subject: ebl_strtabfinalize: Don't SEGV when no strings are present X-Git-Tag: elfutils-0.143~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=077a70854b50c03bf5bbd892e17955088cde4e48;p=thirdparty%2Felfutils.git ebl_strtabfinalize: Don't SEGV when no strings are present (cherry picked from commit a3a81e8352571f8aa9721a8940fbe54543029958) --- diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 30ad7d8ba..8c2f7df14 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,8 @@ +2009-08-06 Petr Machata + + * libebl/eblstrtab.c (ebl_strtabfinalize): Only call copystrings + if we have any strings to copy. + 2009-07-26 Mark Wielaard * eblobjnote.c (ebl_object_note): Handle NT_GNU_GOLD_VERSION. diff --git a/libebl/eblstrtab.c b/libebl/eblstrtab.c index d6ce94aed..ae4e6af07 100644 --- a/libebl/eblstrtab.c +++ b/libebl/eblstrtab.c @@ -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, ©len); + if (st->root) + copystrings (st->root, &endp, ©len); assert (copylen == st->total + nulllen); }