summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2004-04-27 17:51:33 +0000
committerotto <otto@openbsd.org>2004-04-27 17:51:33 +0000
commite9138fa5c1bb9909f221ea1f9779edbff9f30ac6 (patch)
tree08cdfa021b1617e6cf2b8ee9d22ac8f2899319d7 /sys/netinet/tcp_usrreq.c
parentAdd __bounded__ attributes like the other hash functions have. (diff)
downloadwireguard-openbsd-e9138fa5c1bb9909f221ea1f9779edbff9f30ac6.tar.xz
wireguard-openbsd-e9138fa5c1bb9909f221ea1f9779edbff9f30ac6.zip
Require NULL oldp when dropping a connection.
ok markus@
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 496f261dfe6..45ca4f686dc 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.84 2004/04/26 18:16:09 markus Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.85 2004/04/27 17:51:33 otto Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -790,11 +790,9 @@ tcp_ident(oldp, oldlenp, newp, newlen, dodrop)
struct sockaddr_in6 *fin6, *lin6;
struct in6_addr f6, l6;
#endif
- if (oldp == NULL)
- return (EINVAL);
- if (*oldlenp < sizeof(tir))
- return (ENOMEM);
if (dodrop) {
+ if (oldp != NULL || *oldlenp != 0)
+ return (EINVAL);
if (newp == NULL)
return (EPERM);
if (newlen < sizeof(tir))
@@ -802,6 +800,10 @@ tcp_ident(oldp, oldlenp, newp, newlen, dodrop)
if ((error = copyin(newp, &tir, sizeof (tir))) != 0 )
return (error);
} else {
+ if (oldp == NULL)
+ return (EINVAL);
+ if (*oldlenp < sizeof(tir))
+ return (ENOMEM);
if (newp != NULL || newlen != 0)
return (EINVAL);
if ((error = copyin(oldp, &tir, sizeof (tir))) != 0 )