libelf: Rearrange size test to prevent integer overflow
Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
369e66acd7
commit
713a7712a6
@ -62,7 +62,7 @@ _libelf_load_section_headers(Elf *e, void *ehdr)
|
||||
#define CHECK_EHDR(E,EH) do { \
|
||||
if (fsz != (EH)->e_shentsize || \
|
||||
shnum > SIZE_MAX / fsz || \
|
||||
shoff + fsz * shnum > e->e_rawsize) { \
|
||||
fsz * shnum > e->e_rawsize - shoff) { \
|
||||
LIBELF_SET_ERROR(HEADER, 0); \
|
||||
return (0); \
|
||||
} \
|
||||
|
Loading…
x
Reference in New Issue
Block a user