Allow elf_unpack to withstand invalid ELF headers
Change-Id: I10a0f3111176b9614b8531d6736e2e860eb95ce4
This commit is contained in:
parent
ea36b58e62
commit
6f7ac603f2
1 changed files with 2 additions and 1 deletions
|
@ -58,7 +58,8 @@ static int elf_ph_sane(Elf_Phdr *phdr)
|
|||
static int elf_unpack(char *exec_hdr,
|
||||
int hdr_len, Elf_Ehdr **hdr, Elf_Phdr **phdr)
|
||||
{
|
||||
assert(hdr_len >= sizeof(Elf_Ehdr));
|
||||
if(hdr_len < sizeof(Elf_Ehdr))
|
||||
return ENOEXEC;
|
||||
|
||||
*hdr = (Elf_Ehdr *) exec_hdr;
|
||||
if(!elf_sane(*hdr)) {
|
||||
|
|
Loading…
Reference in a new issue