svn commit: r276443 - head/contrib/elftoolchain/libelf
Ed Maste
emaste at FreeBSD.org
Wed Dec 31 01:48:25 UTC 2014
Author: emaste
Date: Wed Dec 31 01:48:23 2014
New Revision: 276443
URL: https://svnweb.freebsd.org/changeset/base/276443
Log:
libelf: Rearrange size test to prevent integer overflow
Sponsored by: The FreeBSD Foundation
Modified:
head/contrib/elftoolchain/libelf/elf_scn.c
Modified: head/contrib/elftoolchain/libelf/elf_scn.c
==============================================================================
--- head/contrib/elftoolchain/libelf/elf_scn.c Wed Dec 31 01:38:02 2014 (r276442)
+++ head/contrib/elftoolchain/libelf/elf_scn.c Wed Dec 31 01:48:23 2014 (r276443)
@@ -62,7 +62,7 @@ _libelf_load_section_headers(Elf *e, voi
#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); \
} \
More information about the svn-src-head
mailing list