diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-01-19 23:03:05 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-01-19 23:03:05 +0000 |
commit | babc9e35464d25604c3f334af5fe73e207563600 (patch) | |
tree | c4416807cdccf9bec2cfbbdb6868130e5fa2c0b0 /sys/kern/kern_exec.c | |
parent | 9502ba530e147cbc1c48ea061cfaf9230d5d0690 (diff) |
do not NULL dereference if fd_nfiles < 3
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index fd3c9ff23c7..4e79d9be9c7 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.34 1999/11/05 01:18:01 mickey Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.35 2000/01/19 23:03:04 deraadt Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -521,7 +521,8 @@ sys_execve(p, v, retval) flags = FREAD | (i == 0 ? 0 : FWRITE); - if (p->p_fd->fd_ofiles[i] == NULL) { + if (i < p->p_fd->fd_nfiles || + p->p_fd->fd_ofiles[i] == NULL) { if ((error = falloc(p, &fp, &indx)) != 0) continue; NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, |