Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add KASSERTs, related to PR/39794.
details: https://anonhg.NetBSD.org/src/rev/7a6b0d83360b
branches: trunk
changeset: 322781:7a6b0d83360b
user: maxv <maxv%NetBSD.org@localhost>
date: Thu May 17 11:59:36 2018 +0000
description:
Add KASSERTs, related to PR/39794.
diffstat:
sys/netinet/ip_input.c | 6 ++++--
sys/netinet6/ip6_input.c | 5 +++--
2 files changed, 7 insertions(+), 4 deletions(-)
diffs (55 lines):
diff -r ab3eb2224bad -r 7a6b0d83360b sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c Thu May 17 11:35:31 2018 +0000
+++ b/sys/netinet/ip_input.c Thu May 17 11:59:36 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_input.c,v 1.383 2018/05/14 17:34:26 maxv Exp $ */
+/* $NetBSD: ip_input.c,v 1.384 2018/05/17 11:59:36 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.383 2018/05/14 17:34:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.384 2018/05/17 11:59:36 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -587,8 +587,10 @@
m = NULL;
goto out;
}
+ KASSERT(m->m_len >= sizeof(struct ip));
ip = mtod(m, struct ip *);
hlen = ip->ip_hl << 2;
+ KASSERT(m->m_len >= hlen);
/*
* XXX The setting of "srcrt" here is to prevent ip_forward()
diff -r ab3eb2224bad -r 7a6b0d83360b sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c Thu May 17 11:35:31 2018 +0000
+++ b/sys/netinet6/ip6_input.c Thu May 17 11:59:36 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_input.c,v 1.202 2018/05/14 17:34:26 maxv Exp $ */
+/* $NetBSD: ip6_input.c,v 1.203 2018/05/17 11:59:36 maxv Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.202 2018/05/14 17:34:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.203 2018/05/17 11:59:36 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@@ -354,6 +354,7 @@
return;
if (m == NULL)
return;
+ KASSERT(m->m_len >= sizeof(struct ip6_hdr));
ip6 = mtod(m, struct ip6_hdr *);
srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst);
}
Home |
Main Index |
Thread Index |
Old Index