summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/recv.2
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1998-07-28 19:47:07 +0000
committermillert <millert@openbsd.org>1998-07-28 19:47:07 +0000
commit1f681a38ff09a42a10d6fd9d1fe951b7460bf87a (patch)
tree0611465b28b9f5a3bab6185f83d5254a85556a41 /lib/libc/sys/recv.2
parentFix indentation problems. (diff)
downloadwireguard-openbsd-1f681a38ff09a42a10d6fd9d1fe951b7460bf87a.tar.xz
wireguard-openbsd-1f681a38ff09a42a10d6fd9d1fe951b7460bf87a.zip
For read, write, send, sendto, recv, recvfrom return EINVAL is size arg > SSIZE_MAX. For readv, writev, sendmsg, recvmsg return EINVAL if sum of the over iov_len values overflows an ssize_t. Based on what XPG 4.2 says (though XPG is not entirely consistent here). Basically since the return value is ssize_t allowing size > SSIZE_MAX is bad since people who (incorrectly mind you) check the return value for < 0 instead of == -1 will have bad things happen to them.
Diffstat (limited to 'lib/libc/sys/recv.2')
-rw-r--r--lib/libc/sys/recv.219
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/libc/sys/recv.2 b/lib/libc/sys/recv.2
index 6da1689db3f..5dea0e73042 100644
--- a/lib/libc/sys/recv.2
+++ b/lib/libc/sys/recv.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: recv.2,v 1.7 1998/07/28 04:49:31 millert Exp $
+.\" $OpenBSD: recv.2,v 1.8 1998/07/28 19:47:14 millert Exp $
.\" $NetBSD: recv.2,v 1.6 1995/02/27 12:36:08 cgd Exp $
.\"
.\" Copyright (c) 1983, 1990, 1991, 1993
@@ -259,7 +259,19 @@ The receive buffer pointer(s) point outside the process's
address space.
.El
.Pp
-In addition,
+In addition,
+.Fn recv
+and
+.Fn recvfrom
+may return following error:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa len
+was larger than
+.Ev SSIZE_MAX .
+.El
+.Pp
+Also,
.Fn recvmsg
may return following error:
.Bl -tag -width Er
@@ -268,7 +280,8 @@ The sum of the
.Fa iov_len
values in the
.Fa msg_iov
-array overflowed an unsigned 32-bit integer.
+array overflowed an
+.Em ssize_t .
.El
.Sh SEE ALSO
.Xr fcntl 2 ,