summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/read.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/read.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/read.2')
-rw-r--r--lib/libc/sys/read.217
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
index 70f8d5c7ab8..9f42215bf7c 100644
--- a/lib/libc/sys/read.2
+++ b/lib/libc/sys/read.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: read.2,v 1.4 1998/07/28 04:13:34 millert Exp $
+.\" $OpenBSD: read.2,v 1.5 1998/07/28 19:47:10 millert Exp $
.\" $NetBSD: read.2,v 1.6 1995/02/27 12:35:47 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
.\"
.\" @(#)read.2 8.4 (Berkeley) 2/26/94
.\"
-.Dd February 26, 1994
+.Dd July 28, 1998
.Dt READ 2
.Os BSD 4
.Sh NAME
@@ -151,6 +151,16 @@ and no data were ready to be read.
.El
.Pp
In addition,
+.Fn read
+may return following error:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa nbytes
+was larger than
+.Ev SSIZE_MAX .
+.El
+.Pp
+Also,
.Fn readv
may return one of the following errors:
.Bl -tag -width Er
@@ -164,7 +174,8 @@ The sum of the
.Fa iov_len
values in the
.Fa iov
-array overflowed an unsigned 32-bit integer.
+array overflowed an
+.Em ssize_t .
.It Bq Er EFAULT
Part of the
.Fa iov