* [COMMITTED] unstrip: Add ELF_CHECK to make sure gelf_getehdr () doesn't return NULL.
@ 2018-11-02 22:19 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2018-11-02 22:19 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
Although we would most likely have seen an error before, make sure we
provide a proper error message in the unlikely case gelf_getehdr ()
returns NULL.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
src/ChangeLog | 5 +++++
src/unstrip.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/ChangeLog b/src/ChangeLog
index 758534d..ca1533d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-02 Mark Wielaard <mark@klomp.org>
+
+ * unstrip.c (copy_elf): Add ELF_CHECK to make sure gelf_getehdr ()
+ doesn't return NULL.
+
2018-10-18 Mark Wielaard <mark@klomp.org>
* elflint.c (check_note_data): Recognize NT_GNU_PROPERTY_TYPE_0.
diff --git a/src/unstrip.c b/src/unstrip.c
index 32da89d..3495b1d 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -245,6 +245,7 @@ copy_elf (Elf *outelf, Elf *inelf)
GElf_Ehdr ehdr_mem;
GElf_Ehdr *ehdr = gelf_getehdr (inelf, &ehdr_mem);
+ ELF_CHECK (ehdr != NULL, _("cannot get ELF header: %s"));
if (shstrndx < SHN_LORESERVE)
ehdr->e_shstrndx = shstrndx;
else
--
1.8.3.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-11-02 22:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-02 22:19 [COMMITTED] unstrip: Add ELF_CHECK to make sure gelf_getehdr () doesn't return NULL Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).