diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-03-06 18:34:18 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-03-06 18:34:18 +0000 |
commit | 4b440a37455b4889b6d707a6aefc4bdec688697e (patch) | |
tree | 1bd9421982fe36e080f0434fe5a70c821fc057a5 /sys/netinet/udp_usrreq.c | |
parent | 8e5a9c5d4beaa83b66abd7027f4cecef9361efc2 (diff) |
Move the test for bogus packet length in udp_output() closer to the top of
the function. Previously it was possible for us to get stuck in splsoftnet()
under certain situations. Bug reported by hunter@dg.net.ua, fix by me ok'd
by deraadt@, provos@, angelos@.
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r-- | sys/netinet/udp_usrreq.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 1f9319203f4..6f31222a7b0 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.54 2001/02/16 16:17:31 itojun Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.55 2001/03/06 18:34:17 aaron Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -887,6 +887,15 @@ udp_output(m, va_alist) panic("IPv6 inpcb to udp_output"); #endif + /* + * Compute the packet length of the IP header, and + * punt if the length looks bogus. + */ + if ((len + sizeof(struct udpiphdr)) > IP_MAXPACKET) { + error = EMSGSIZE; + goto release; + } + if (addr) { /* * Save current PCB flags because they may change during @@ -925,15 +934,6 @@ udp_output(m, va_alist) } /* - * Compute the packet length of the IP header, and - * punt if the length looks bogus. - */ - if ((len + sizeof(struct udpiphdr)) > IP_MAXPACKET) { - error = EMSGSIZE; - goto release; - } - - /* * Fill in mbuf with extended UDP header * and addresses and length put into network format. */ |