X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6d2010ae8f7a6078e10b361c6962983bab233e0f..bb59bff194111743b33cc36712410b5656329d3c:/bsd/netinet6/ipcomp_input.c diff --git a/bsd/netinet6/ipcomp_input.c b/bsd/netinet6/ipcomp_input.c index 3c6a9a43d..c3b330305 100644 --- a/bsd/netinet6/ipcomp_input.c +++ b/bsd/netinet6/ipcomp_input.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -96,7 +97,6 @@ ipcomp4_input(struct mbuf *m, int off) size_t newlen, olen; struct secasvar *sav = NULL; - if (m->m_pkthdr.len < off + sizeof(struct ipcomp)) { ipseclog((LOG_DEBUG, "IPv4 IPComp input: assumption failed " "(packet too short)\n")); @@ -113,6 +113,10 @@ ipcomp4_input(struct mbuf *m, int off) goto fail; } ipcomp = mtod(md, struct ipcomp *); + + /* Expect 32-bit aligned data pointer on strict-align platforms */ + MBUF_STRICT_DATA_ALIGNMENT_CHECK_32(m); + ip = mtod(m, struct ip *); nxt = ipcomp->comp_nxt; #ifdef _IP_VHL @@ -266,6 +270,10 @@ ipcomp6_input(struct mbuf **mp, int *offp, int proto) goto fail; } ipcomp = mtod(md, struct ipcomp *); + + /* Expect 32-bit aligned data pointer on strict-align platforms */ + MBUF_STRICT_DATA_ALIGNMENT_CHECK_32(m); + ip6 = mtod(m, struct ip6_hdr *); nxt = ipcomp->comp_nxt;