diff options
| author | Mark Wielaard <[email protected]> | 2014-12-31 00:51:45 +0100 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-01-15 14:04:28 +0100 |
| commit | cc62e378c292daaded19f1fe03681d63b7437ea0 (patch) | |
| tree | b61389196a961c575d901b7a41e5f936455ca526 /libelf/libelfP.h | |
| parent | d973206f716d441634f3b937be9c8c5b8b6250db (diff) | |
libelf: gelf_getphdr should check phdr index is valid.
elf_getphdrnum does checks the phdrnum makes sense. But gelf_getphdr
checked the given index against the "raw" e_phnum or internal
__elf_getphdrnum_rdlock result without checking. Extract the checking
code into a new internal __elf_getphdrnum_chk_rdlock function and
use that.
Found by afl-fuzz.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/libelfP.h')
| -rw-r--r-- | libelf/libelfP.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libelf/libelfP.h b/libelf/libelfP.h index 52cf7457..3b24e75c 100644 --- a/libelf/libelfP.h +++ b/libelf/libelfP.h @@ -511,6 +511,8 @@ extern Elf_Scn *__elf64_offscn_internal (Elf *__elf, Elf64_Off __offset) attribute_hidden; extern int __elf_getphdrnum_rdlock (Elf *__elf, size_t *__dst) internal_function; +extern int __elf_getphdrnum_chk_rdlock (Elf *__elf, size_t *__dst) + internal_function; extern int __elf_getshdrnum_rdlock (Elf *__elf, size_t *__dst) internal_function; extern int __elf_getshdrstrndx_internal (Elf *__elf, size_t *__dst) |
