summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/write.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/write.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/write.2')
-rw-r--r--lib/libc/sys/write.219
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
index b5d6bb5dcef..5acf9029136 100644
--- a/lib/libc/sys/write.2
+++ b/lib/libc/sys/write.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: write.2,v 1.5 1998/07/28 04:13:33 millert Exp $
+.\" $OpenBSD: write.2,v 1.6 1998/07/28 19:47:11 millert Exp $
.\" $NetBSD: write.2,v 1.6 1995/02/27 12:39:43 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
.\"
.\" @(#)write.2 8.5 (Berkeley) 4/2/94
.\"
-.Dd April 2, 1994
+.Dd July 28, 1998
.Dt WRITE 2
.Os BSD 4
.Sh NAME
@@ -177,7 +177,17 @@ The file was marked for non-blocking I/O,
and no data could be written immediately.
.El
.Pp
-In addition,
+In addition,
+.Fn write
+may return following error:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa nbytes
+was larger than
+.Ev SSIZE_MAX .
+.El
+.Pp
+Also,
.Fn writev
may return one of the following errors:
.Bl -tag -width Er
@@ -190,7 +200,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 .
.El
.Sh SEE ALSO
.Xr fcntl 2 ,