mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
libelf: Rearrange size test to prevent integer overflow
Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
d866a563d4
commit
47fc54d8b0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276443
|
@ -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…
Reference in a new issue