From: Mark Wielaard Date: Tue, 27 May 2014 08:25:27 +0000 (+0200) Subject: readelf: Skip section if name is NULL in print_debug. X-Git-Tag: elfutils-0.160~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=903f334ef06fbec28d23b7c8ea3c79cacc1da14f;p=thirdparty%2Felfutils.git readelf: Skip section if name is NULL in print_debug. Don't crash and burn when a section doesn't have a name (possibly invalid ELF file string table). Just try the next section instead of calling strcmp on NULL. Signed-off-by: Mark Wielaard --- diff --git a/src/ChangeLog b/src/ChangeLog index 5535cff72..7e680361a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-05-27 Mark Wielaard + + * readelf.c (print_debug): Skip section if name is NULL. + 2014-05-26 Mark Wielaard * readelf.c (handle_relocs_rela): Print header like handle_relocs_rel diff --git a/src/readelf.c b/src/readelf.c index ea14a09b9..6bbe436d3 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -7962,8 +7962,10 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) / sizeof (debug_sections[0])); const char *name = elf_strptr (ebl->elf, shstrndx, shdr->sh_name); - int n; + if (name == NULL) + continue; + int n; for (n = 0; n < ndebug_sections; ++n) if (strcmp (name, debug_sections[n].name) == 0 #if USE_ZLIB