summaryrefslogtreecommitdiffstats
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>2000-01-07 16:34:10 +0000
committerangelos <angelos@openbsd.org>2000-01-07 16:34:10 +0000
commit87ff0246c3eda772e820ca0eaa5061a6cfeb018c (patch)
tree18301d35ac9751e08a3af1286fc78078619770d2 /sys/netinet/udp_usrreq.c
parentsync with Greg Oster's NetBSD changes to Jan 4th 2000 (diff)
downloadwireguard-openbsd-87ff0246c3eda772e820ca0eaa5061a6cfeb018c.tar.xz
wireguard-openbsd-87ff0246c3eda772e820ca0eaa5061a6cfeb018c.zip
Early check for destination port 0 (itojun@)
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 561d9bba850..25f22489ba7 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.36 2000/01/04 10:38:36 itojun Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.37 2000/01/07 16:34:10 angelos Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -248,6 +248,12 @@ udp_input(m, va_alist)
}
uh = (struct udphdr *)(mtod(m, caddr_t) + iphlen);
+ /* Check for illegal destination port 0 */
+ if (uh->uh_dport == 0) {
+ udpstat.udps_noport++;
+ goto bad;
+ }
+
/*
* Make mbuf data length reflect UDP length.
* If not enough data to reflect UDP length, drop.