diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-02-14 19:24:06 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-02-14 19:24:06 +0000 |
commit | 5cfca43ba836c31aa1cd90f33825e3c414b748e3 (patch) | |
tree | deb7e4531a3efacbf21649a74307eaa1b518a6d8 | |
parent | d3c057cb213552b36fc591abb64e7530d6006909 (diff) |
Don't do range checking on namelen unless name is non-NULL, otherwise
namelen is uninitialized.
-rw-r--r-- | sys/kern/uipc_syscalls.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index ee626a84ba1..a4e1c0fd2ab 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.15 1999/02/14 19:02:20 millert Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.16 1999/02/14 19:24:05 millert Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -156,11 +156,13 @@ sys_accept(p, v, retval) int namelen, error, s, tmpfd; register struct socket *so; - if (SCARG(uap, name) && (error = copyin((caddr_t)SCARG(uap, anamelen), - (caddr_t)&namelen, sizeof (namelen)))) - return (error); - if (namelen < 0) - return (EFAULT); + if (SCARG(uap, name)) { + if ((error = copyin((caddr_t)SCARG(uap, anamelen), + (caddr_t)&namelen, sizeof (namelen)))) + return (error); + if (namelen < 0) + return (EFAULT); + } if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); s = splsoftnet(); |