diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2002-11-26 17:22:15 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2002-11-26 17:22:15 +0000 |
| commit | 04f4a16448a0c79a1a90310be12168b28f0903c5 (patch) | |
| tree | 9ed4a394b401eaf22a67ecbfc26542743210735d | |
| parent | 4d10c0ce5fd2ae3de65c683f0650a7323d38f35f (diff) | |
Notes
| -rw-r--r-- | sys/kern/kern_descrip.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 13b339b76c9a..852cd393050c 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -469,10 +469,11 @@ do_dup(td, type, old, new, retval) * Verify we have a valid descriptor to dup from and possibly to * dup to. */ + if (old < 0 || new < 0 || new >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur || + new >= maxfilesperproc) + return (EBADF); FILEDESC_LOCK(fdp); - if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL || - new >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur || - new >= maxfilesperproc) { + if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL) { FILEDESC_UNLOCK(fdp); return (EBADF); } |
