diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2019-12-01 00:22:04 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2019-12-01 00:22:04 +0000 |
| commit | a4adf6cc653fa8ed9b1d06052f00b2481688d711 (patch) | |
| tree | 88273d8b1ee747ad53e86d680746812eaaa45ae9 /sys/netinet6/udp6_usrreq.c | |
| parent | 1b50b999f9b57eff89002c40559487de9ac43646 (diff) | |
Notes
Diffstat (limited to 'sys/netinet6/udp6_usrreq.c')
| -rw-r--r-- | sys/netinet6/udp6_usrreq.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 64e5f6e3551fa..124bded74a404 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -223,11 +223,13 @@ udp6_input(struct mbuf **mp, int *offp, int proto) ifp = m->m_pkthdr.rcvif; - m = m_pullup(m, off + sizeof(struct udphdr)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = NULL; - return (IPPROTO_DONE); + if (m->m_len < off + sizeof(struct udphdr)) { + m = m_pullup(m, off + sizeof(struct udphdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (IPPROTO_DONE); + } } ip6 = mtod(m, struct ip6_hdr *); uh = (struct udphdr *)((caddr_t)ip6 + off); |
