Check the size of data available in mbuf, before using them.
PR: 202667 MFC after: 1 week
This commit is contained in:
parent
e6b0222d60
commit
50bc87bc43
@ -691,6 +691,14 @@ gre_input(struct mbuf **mp, int *offp, int proto)
|
||||
KASSERT(sc != NULL, ("encap_getarg returned NULL"));
|
||||
|
||||
ifp = GRE2IFP(sc);
|
||||
hlen = *offp + sizeof(struct grehdr) + 4 * sizeof(uint32_t);
|
||||
if (m->m_pkthdr.len < hlen)
|
||||
goto drop;
|
||||
if (m->m_len < hlen) {
|
||||
m = m_pullup(m, hlen);
|
||||
if (m == NULL)
|
||||
goto drop;
|
||||
}
|
||||
gh = (struct grehdr *)mtodo(m, *offp);
|
||||
flags = ntohs(gh->gre_flags);
|
||||
if (flags & ~GRE_FLAGS_MASK)
|
||||
|
Loading…
Reference in New Issue
Block a user