Check for UDP/IPv6 packets that the length in the UDP header is at least

the minimum. Make the check similar to the one for UDPLite/IPv6.

MFC after: 3 days
This commit is contained in:
Michael Tuexen 2014-10-02 10:49:01 +00:00
parent b8f810fecd
commit 5055cfcb4d

View File

@ -237,18 +237,9 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
/* XXX: What is the right UDPLite MIB counter? */
goto badunlocked;
}
}
if (nxt == IPPROTO_UDP && plen != ulen) {
UDPSTAT_INC(udps_badlen);
goto badunlocked;
}
/*
* Checksum extended UDP header and data.
*/
if (uh->uh_sum == 0) {
if (ulen > plen || ulen < sizeof(struct udphdr)) {
UDPSTAT_INC(udps_nosum);
} else {
if ((ulen < sizeof(struct udphdr)) || (plen != ulen)) {
UDPSTAT_INC(udps_badlen);
goto badunlocked;
}
}