add check for wrapping of address + size in exec()

This commit is contained in:
MikeCAT 2015-12-20 00:04:52 +09:00 committed by Frans Kaashoek
parent 67a7f9597e
commit 5625ae4973

2
exec.c
View file

@ -44,6 +44,8 @@ exec(char *path, char **argv)
continue;
if(ph.memsz < ph.filesz)
goto bad;
if(ph.vaddr + ph.memsz < ph.vaddr)
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
if(ph.vaddr % PGSIZE != 0)