diff options
Diffstat (limited to 'libelf/elf32_getphdr.c')
| -rw-r--r-- | libelf/elf32_getphdr.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c index 0a617a67..507fc2aa 100644 --- a/libelf/elf32_getphdr.c +++ b/libelf/elf32_getphdr.c @@ -105,6 +105,13 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) size_t size = phnum * sizeof (ElfW2(LIBELFBITS,Phdr)); + if (ehdr->e_phoff < elf->maximum_size + || elf->maximum_size - ehdr->e_phoff < size) + { + __libelf_seterrno (ELF_E_INVALID_DATA); + goto out; + } + if (elf->map_address != NULL) { /* All the data is already mapped. Use it. */ |
