mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump: read_elf_phdrs: handle no program header case
Handle the case where no program headers are defined (see `man 5 elf`). Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
8944c2f60d
commit
09c413b1be
@@ -69,6 +69,11 @@ Elf64_Phdr *read_elf_phdrs(const struct zg_fh *fh, const Elf64_Ehdr *ehdr, unsig
|
||||
size_t phdrs_size;
|
||||
Elf64_Phdr *phdrs;
|
||||
|
||||
if (!phnum) {
|
||||
*phdr_count = phnum;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Cannot wraparound since `Elf64_Half`` is `uint16_t` */
|
||||
phdrs_size = sizeof(*phdrs) * phnum;
|
||||
phdrs = util_malloc(phdrs_size);
|
||||
|
||||
Reference in New Issue
Block a user