From 077a70854b50c03bf5bbd892e17955088cde4e48 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Thu, 6 Aug 2009 18:45:08 +0200 Subject: [PATCH] ebl_strtabfinalize: Don't SEGV when no strings are present (cherry picked from commit a3a81e8352571f8aa9721a8940fbe54543029958) --- libebl/ChangeLog | 5 +++++ libebl/eblstrtab.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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); } -- 2.47.2