summaryrefslogtreecommitdiffstats
path: root/src/readelf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/readelf.c')
-rw-r--r--src/readelf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/readelf.c b/src/readelf.c
index fc2abfc3..d5a3b8d4 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -976,6 +976,10 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
}
}
+ if (ehdr->e_shnum == 0)
+ /* No sections in the file. Punt. */
+ return;
+
/* Get the section header string table index. */
size_t shstrndx;
if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))