summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2018-03-07 08:40:38 -0300
committerRenato Botelho <renato@netgate.com>2018-03-07 08:40:38 -0300
commit71e3c5cbbbdaf7023423bf4aecf933a3165f58ee (patch)
treeddbe27e0296a8d07fb92ee7c3f8ff898564eae4d /sys
parentc4c45edd775b251ba14c1394fbc9c8908f9aee87 (diff)
parentc69c8ae8053b66933da68a1f410f78dda1300dd7 (diff)
downloadFreeBSD-src-71e3c5cbbbdaf7023423bf4aecf933a3165f58ee.zip
FreeBSD-src-71e3c5cbbbdaf7023423bf4aecf933a3165f58ee.tar.gz
Merge remote-tracking branch 'origin/releng/11.1' into RELENG_2_4
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/newvers.sh2
-rw-r--r--sys/netipsec/xform_ah.c15
2 files changed, 15 insertions, 2 deletions
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 75b4847..0a0893e 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -44,7 +44,7 @@
TYPE="FreeBSD"
REVISION="11.1"
-BRANCH="RELEASE-p6"
+BRANCH="RELEASE-p7"
if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
diff --git a/sys/netipsec/xform_ah.c b/sys/netipsec/xform_ah.c
index 530542d..44d4b1b 100644
--- a/sys/netipsec/xform_ah.c
+++ b/sys/netipsec/xform_ah.c
@@ -582,6 +582,16 @@ ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
error = EACCES;
goto bad;
}
+ if (skip + authsize + rplen > m->m_pkthdr.len) {
+ DPRINTF(("%s: bad mbuf length %u (expecting %lu)"
+ " for packet in SA %s/%08lx\n", __func__,
+ m->m_pkthdr.len, (u_long) (skip + authsize + rplen),
+ ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)),
+ (u_long) ntohl(sav->spi)));
+ AHSTAT_INC(ahs_badauthl);
+ error = EACCES;
+ goto bad;
+ }
AHSTAT_ADD(ahs_ibytes, m->m_pkthdr.len - skip - hl);
/* Get crypto descriptors. */
@@ -626,6 +636,9 @@ ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
/* Zeroize the authenticator on the packet. */
m_copyback(m, skip + rplen, authsize, ipseczeroes);
+ /* Save ah_nxt, since ah pointer can become invalid after "massage" */
+ hl = ah->ah_nxt;
+
/* "Massage" the packet headers for crypto processing. */
error = ah_massage_headers(&m, sav->sah->saidx.dst.sa.sa_family,
skip, ahx->type, 0);
@@ -650,7 +663,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
/* These are passed as-is to the callback. */
xd->sav = sav;
- xd->nxt = ah->ah_nxt;
+ xd->nxt = hl;
xd->protoff = protoff;
xd->skip = skip;
xd->cryptoid = cryptoid;
OpenPOWER on IntegriCloud