Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys destination port == 0 is illegal based on RFC768.



details:   https://anonhg.NetBSD.org/src/rev/2ae17cd660f5
branches:  trunk
changeset: 481432:2ae17cd660f5
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jan 31 10:39:26 2000 +0000

description:
destination port == 0 is illegal based on RFC768.
(NetBSD PR: 9137 - I thought I committed this already but I wasn't)

diffstat:

 sys/netinet/udp_usrreq.c   |  14 +++++++++++++-
 sys/netinet6/udp6_usrreq.c |   6 +++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diffs (62 lines):

diff -r d3d77c10a99c -r 2ae17cd660f5 sys/netinet/udp_usrreq.c
--- a/sys/netinet/udp_usrreq.c  Mon Jan 31 10:33:22 2000 +0000
+++ b/sys/netinet/udp_usrreq.c  Mon Jan 31 10:39:26 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp_usrreq.c,v 1.56 2000/01/06 15:46:08 itojun Exp $   */
+/*     $NetBSD: udp_usrreq.c,v 1.57 2000/01/31 10:39:26 itojun Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -219,6 +219,10 @@
        }
 #endif
 
+       /* destination port of 0 is illegal, based on RFC768. */
+       if (uh->uh_dport == 0)
+               goto bad;
+
        /*
         * Make mbuf data length reflect UDP length.
         * If not enough data to reflect UDP length, drop.
@@ -376,6 +380,10 @@
                goto bad;
        }
 
+       /* destination port of 0 is illegal, based on RFC768. */
+       if (uh->uh_dport == 0)
+               goto bad;
+
        /* Be proactive about malicious use of IPv4 mapped address */
        if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) ||
            IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) {
@@ -928,6 +936,10 @@
        }
        uh = (struct udphdr *)((caddr_t)ip + iphlen);
 
+       /* destination port of 0 is illegal, based on RFC768. */
+       if (uh->uh_dport == 0)
+               goto bad;
+
        /*
         * Make mbuf data length reflect UDP length.
         * If not enough data to reflect UDP length, drop.
diff -r d3d77c10a99c -r 2ae17cd660f5 sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c        Mon Jan 31 10:33:22 2000 +0000
+++ b/sys/netinet6/udp6_usrreq.c        Mon Jan 31 10:39:26 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp6_usrreq.c,v 1.17 2000/01/06 15:46:11 itojun Exp $  */
+/*     $NetBSD: udp6_usrreq.c,v 1.18 2000/01/31 10:39:27 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -193,6 +193,10 @@
                goto bad;
        }
 
+       /* destination port of 0 is illegal, based on RFC768. */
+       if (uh->uh_dport == 0)
+               goto bad;
+
        /* Be proactive about malicious use of IPv4 mapped address */
        if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) ||
            IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) {



Home | Main Index | Thread Index | Old Index