Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netipsec Make sure the Authentication Header fits the mb...
details: https://anonhg.NetBSD.org/src/rev/50fbaa92a46f
branches: trunk
changeset: 829854:50fbaa92a46f
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Feb 15 07:38:46 2018 +0000
description:
Make sure the Authentication Header fits the mbuf chain, otherwise panic.
diffstat:
sys/netipsec/xform_ah.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r 3ae013e09578 -r 50fbaa92a46f sys/netipsec/xform_ah.c
--- a/sys/netipsec/xform_ah.c Thu Feb 15 07:16:05 2018 +0000
+++ b/sys/netipsec/xform_ah.c Thu Feb 15 07:38:46 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xform_ah.c,v 1.80 2018/02/15 07:16:05 maxv Exp $ */
+/* $NetBSD: xform_ah.c,v 1.81 2018/02/15 07:38:46 maxv Exp $ */
/* $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
/*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.80 2018/02/15 07:16:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.81 2018/02/15 07:38:46 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -670,6 +670,17 @@
error = EACCES;
goto bad;
}
+ if (skip + authsize + rplen > m->m_pkthdr.len) {
+ char buf[IPSEC_ADDRSTRLEN];
+ 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)));
+ stat = AH_STAT_BADAUTHL;
+ error = EACCES;
+ goto bad;
+ }
AH_STATADD(AH_STAT_IBYTES, m->m_pkthdr.len - skip - hl);
Home |
Main Index |
Thread Index |
Old Index