]> git.ipfire.org Git - thirdparty/libbsd.git/commit
nlist: Check that e_shnum and e_shentsize are within bounds
authorGuillem Jover <guillem@hadrons.org>
Sat, 15 Jun 2019 12:33:32 +0000 (14:33 +0200)
committerGuillem Jover <guillem@hadrons.org>
Thu, 8 Aug 2019 01:22:09 +0000 (03:22 +0200)
commite9529d9b4a7833049d34b4ec3bf018bdfe68c807
treec72671cdf26057e4b8c2f6ded3a4e8e96d3d840a
parent3aaedb12086a77c5ea7564eb3b5b2f02f788fe61
nlist: Check that e_shnum and e_shentsize are within bounds

The e_shnum must not be 0, otherwise we will do a zero sized allocation
and further processing of the executable will lead to out of bounds
read/write accesses. The e_shentsize must be equal to sizeof(Elf_Shdr),
otherwise we will perform out of bounds read accesses on the shdr array.

Reported-by: Daniel Hodson <daniel@elttam.com.au>
Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
src/nlist.c