diff options
| author | Russ Cox <rsc@swtch.com> | 2009-08-08 01:07:30 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@swtch.com> | 2009-08-08 01:07:30 -0700 |
| commit | 0aef8914959af9e472852611eb6352c211093d35 (patch) | |
| tree | 0658cf47dcb134b79e5311209c2a2840d1a79650 /exec.c | |
| parent | b3bebfce8a790975ba941d346e6bcff1b5afecf9 (diff) | |
| download | xv6-labs-2022-0aef8914959af9e472852611eb6352c211093d35.tar.xz xv6-labs-2022-0aef8914959af9e472852611eb6352c211093d35.zip | |
shuffle and tweak for formatting.
pdf has very good page breaks now.
would be a good copy for fall 2009.
Diffstat (limited to 'exec.c')
| -rw-r--r-- | exec.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -11,7 +11,7 @@ exec(char *path, char **argv) { char *mem, *s, *last; int i, argc, arglen, len, off; - uint sz, sp, argp; + uint sz, sp, argp, x; struct elfhdr elf; struct inode *ip; struct proghdr ph; @@ -67,7 +67,9 @@ exec(char *path, char **argv) goto bad; if(ph.type != ELF_PROG_LOAD) continue; - if(ph.va + ph.memsz < ph.va || ph.va + ph.memsz > sz || ph.memsz < ph.filesz) + if(ph.va + ph.memsz < ph.va || ph.va + ph.memsz > sz) + goto bad; + if(ph.memsz < ph.filesz) goto bad; if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz) goto bad; |
