summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_syscalls.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-07-28 00:13:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-07-28 00:13:59 +0000
commit70ac9fcbf4cbec8e4d581e0b0f8b229456a5a517 (patch)
treeb442ce56b4b49eb012118536460cb63905d9fb20 /sys/kern/uipc_syscalls.c
parent7308bbe616f2495a440fa39e81d63067dad625ad (diff)
Return EINVAL when msg_iovlen or iovcnt <= 0; Make uio_resid unsigned (size_t) and don't return EINVAL if it is < 0 in sys_{read,write}. Remove check for uio_resid < 0 uiomove() now that uio_resid is unsigned and brack remaining panics with #ifdef DIAGNOSTIC. vn_rdwr() must now take a size_t * as its 9th argument so change that and clean up uses of vn_rdwr(). Fixes 549 + more
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r--sys/kern/uipc_syscalls.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 65290c40d67..e2b73cb0e66 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.7 1998/02/08 22:41:36 tholo Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.8 1998/07/28 00:12:56 millert Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -385,6 +385,8 @@ sys_sendmsg(p, v, retval)
error = copyin(SCARG(uap, msg), (caddr_t)&msg, sizeof (msg));
if (error)
return (error);
+ if (msg.msg_iovlen <= 0)
+ return (EINVAL);
if ((u_int)msg.msg_iovlen >= UIO_SMALLIOV) {
if ((u_int)msg.msg_iovlen >= UIO_MAXIOV)
return (EMSGSIZE);
@@ -568,6 +570,8 @@ sys_recvmsg(p, v, retval)
sizeof (msg));
if (error)
return (error);
+ if (msg.msg_iovlen <= 0)
+ return (EINVAL);
if ((u_int)msg.msg_iovlen >= UIO_SMALLIOV) {
if ((u_int)msg.msg_iovlen >= UIO_MAXIOV)
return (EMSGSIZE);