exec sanity check
This commit is contained in:
parent
f3685aa391
commit
90bab90832
1 changed files with 1 additions and 1 deletions
2
exec.c
2
exec.c
|
@ -62,7 +62,7 @@ exec(char *path, char **argv)
|
|||
goto bad;
|
||||
if(ph.type != ELF_PROG_LOAD)
|
||||
continue;
|
||||
if(ph.va + ph.memsz > sz)
|
||||
if(ph.va + ph.memsz < ph.va || ph.va + ph.memsz > sz || ph.memsz < ph.filesz)
|
||||
goto bad;
|
||||
if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz)
|
||||
goto bad;
|
||||
|
|
Loading…
Reference in a new issue