diff options
author | 1997-11-15 19:57:49 +0000 | |
---|---|---|
committer | 1997-11-15 19:57:49 +0000 | |
commit | 7aa8180a9faefd8bede4f09f62e9b2538ca523fb (patch) | |
tree | d10a4627c17b60e66ef418d94c5de3adc08649e9 | |
parent | fix memory management errors (diff) | |
download | wireguard-openbsd-7aa8180a9faefd8bede4f09f62e9b2538ca523fb.tar.xz wireguard-openbsd-7aa8180a9faefd8bede4f09f62e9b2538ca523fb.zip |
for shutdown(2), if "how" is not 0-2, return EINVAL
-rw-r--r-- | lib/libc/sys/shutdown.2 | 3 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/sys/shutdown.2 b/lib/libc/sys/shutdown.2 index 927e3bdf329..9a9b2351b3f 100644 --- a/lib/libc/sys/shutdown.2 +++ b/lib/libc/sys/shutdown.2 @@ -64,6 +64,9 @@ A 0 is returned if the call succeeds, -1 if it fails. .Sh ERRORS The call succeeds unless: .Bl -tag -width Er +.It Bq Er EINVAL +.Fa how +is not in the valid range of 0 - 2. .It Bq Er EBADF .Fa S is not a valid descriptor. diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 7e9f76191ad..4ee230dcc1e 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.18 1997/11/11 18:22:49 deraadt Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.19 1997/11/15 19:57:51 deraadt Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -818,6 +818,8 @@ soshutdown(so, how) register struct protosw *pr = so->so_proto; how++; + if (how & ~(FREAD|FWRITE)) + return (EINVAL); if (how & FREAD) sorflush(so); if (how & FWRITE) |