summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2013-03-13 22:01:31 +0000
committertijl <tijl@FreeBSD.org>2013-03-13 22:01:31 +0000
commitf0c5e712269b4ee1c145a80c1f9620999395f39e (patch)
treedc73c1fed8f6ebe2ea0a53a8f56f0792b751512b /lib/libc
parentb2e811621c23b090f0a6428e112a67cbdb48769d (diff)
downloadFreeBSD-src-f0c5e712269b4ee1c145a80c1f9620999395f39e.zip
FreeBSD-src-f0c5e712269b4ee1c145a80c1f9620999395f39e.tar.gz
- Fix two possible overflows when testing if ELF program headers are on
the first page: 1. Cast uint16_t operands in a multiplication to unsigned int because otherwise the implicit promotion to int results in a signed multiplication that can overflow and the behaviour on integer overflow is undefined. 2. Replace (offset + size > PAGE_SIZE) with (size > PAGE_SIZE - offset) because the sum may overflow. - Use the same tests to see if the path to the interpreter is on the first page. There's no overflow here because size is already limited by MAXPATHLEN, but the compiler optimises the new tests better. Also fix an off-by-one error. - Simplify tests to see if an ELF note program header is on the first page. This also fixes an off-by-one error. Reviewed by: kib MFC after: 1 week
Diffstat (limited to 'lib/libc')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud