Skip to content

Commit

Permalink
exec sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
rsc committed May 31, 2009
1 parent f3685aa commit 90bab90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 90bab90

Please sign in to comment.