Per XNS Issue 5, calling recvmsg(2) or sendmsg(2) with an msg.msg_iovlen less
than or equal to 0 shall fail with EMSGSIZE; the latter condition was not being checked for. Also, document the msg.msg_iovlen > {IOV_MAX} case.
This commit is contained in:
parent
f6fd0956f2
commit
7b07ad780a
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: recv.2,v 1.9 1998/07/29 02:11:36 thorpej Exp $
|
||||
.\" $NetBSD: recv.2,v 1.10 1998/08/04 19:48:34 kleink Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1990, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -257,6 +257,19 @@ address space.
|
||||
The total length of the I/O is more than can be expressed by the ssize_t
|
||||
return value.
|
||||
.El
|
||||
.Pp
|
||||
.Fn Recvmsg
|
||||
will also fail if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EMSGSIZE
|
||||
The
|
||||
.Fa msg_iovlen
|
||||
member of the
|
||||
.Fa msg
|
||||
structure is less than or equal to 0
|
||||
or is greater than
|
||||
.Dv {IOV_MAX} .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr fcntl 2 ,
|
||||
.Xr read 2 ,
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: send.2,v 1.9 1998/07/29 02:11:35 thorpej Exp $
|
||||
.\" $NetBSD: send.2,v 1.10 1998/08/04 19:48:34 kleink Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -159,6 +159,19 @@ The destination for the message is unreachable.
|
||||
The total length of the I/O is more than can be expressed by the ssize_t
|
||||
return value.
|
||||
.El
|
||||
.Pp
|
||||
.Fn Sendmsg
|
||||
will also fail if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EMSGSIZE
|
||||
The
|
||||
.Fa msg_iovlen
|
||||
member of the
|
||||
.Fa msg
|
||||
structure is less than or equal to 0
|
||||
or is greater than
|
||||
.Dv {IOV_MAX} .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr fcntl 2 ,
|
||||
.Xr recv 2 ,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uipc_syscalls.c,v 1.37 1998/08/04 12:19:15 kleink Exp $ */
|
||||
/* $NetBSD: uipc_syscalls.c,v 1.38 1998/08/04 19:48:35 kleink Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1990, 1993
|
||||
@ -392,11 +392,13 @@ sys_sendmsg(p, v, retval)
|
||||
MALLOC(iov, struct iovec *,
|
||||
sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV,
|
||||
M_WAITOK);
|
||||
} else
|
||||
} else if ((u_int)msg.msg_iovlen > 0)
|
||||
iov = aiov;
|
||||
if (msg.msg_iovlen &&
|
||||
(error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov,
|
||||
(unsigned)(msg.msg_iovlen * sizeof(struct iovec)))))
|
||||
else
|
||||
return (EMSGSIZE);
|
||||
error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov,
|
||||
(size_t)(msg.msg_iovlen * sizeof(struct iovec)));
|
||||
if (error)
|
||||
goto done;
|
||||
msg.msg_iov = iov;
|
||||
#ifdef COMPAT_OLDSOCK
|
||||
@ -587,8 +589,10 @@ sys_recvmsg(p, v, retval)
|
||||
MALLOC(iov, struct iovec *,
|
||||
sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV,
|
||||
M_WAITOK);
|
||||
} else
|
||||
} else if ((u_int)msg.msg_iovlen > 0)
|
||||
iov = aiov;
|
||||
else
|
||||
return (EMSGSIZE);
|
||||
#ifdef COMPAT_OLDSOCK
|
||||
msg.msg_flags = SCARG(uap, flags) &~ MSG_COMPAT;
|
||||
#else
|
||||
@ -597,7 +601,7 @@ sys_recvmsg(p, v, retval)
|
||||
uiov = msg.msg_iov;
|
||||
msg.msg_iov = iov;
|
||||
error = copyin((caddr_t)uiov, (caddr_t)iov,
|
||||
(unsigned)(msg.msg_iovlen * sizeof(struct iovec)));
|
||||
(size_t)(msg.msg_iovlen * sizeof(struct iovec)));
|
||||
if (error)
|
||||
goto done;
|
||||
if ((error = recvit(p, SCARG(uap, s), &msg, (caddr_t)0, retval)) == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user