Skip to content
Snippets Groups Projects
Commit 90bab908 authored by rsc's avatar rsc
Browse files

exec sanity check

parent f3685aa3
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment