Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Only check that the offset < sizeof(struct ip) i...
details: https://anonhg.NetBSD.org/src/rev/6359c3f244cc
branches: trunk
changeset: 334665:6359c3f244cc
user: christos <christos%NetBSD.org@localhost>
date: Sun Nov 30 18:15:41 2014 +0000
description:
Only check that the offset < sizeof(struct ip) if nxt != 0, i.e. in the
tcp and udp cases. From kre.
XXX: pullup 7
diffstat:
sys/netinet/in4_cksum.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (39 lines):
diff -r dead6b9596f9 -r 6359c3f244cc sys/netinet/in4_cksum.c
--- a/sys/netinet/in4_cksum.c Sun Nov 30 15:54:34 2014 +0000
+++ b/sys/netinet/in4_cksum.c Sun Nov 30 18:15:41 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in4_cksum.c,v 1.19 2013/03/12 21:54:36 christos Exp $ */
+/* $NetBSD: in4_cksum.c,v 1.20 2014/11/30 18:15:41 christos Exp $ */
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in4_cksum.c,v 1.19 2013/03/12 21:54:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in4_cksum.c,v 1.20 2014/11/30 18:15:41 christos Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -58,9 +58,6 @@
uint32_t sum;
uint16_t *w;
- if (__predict_false(off < sizeof(struct ip)))
- PANIC("%s: offset %d too short for IP header %zu", __func__,
- off, sizeof(struct ip));
if (__predict_false(m->m_len < sizeof(struct ip)))
PANIC("%s: mbuf %d too short for IP header %zu", __func__,
m->m_len, sizeof(struct ip));
@@ -68,6 +65,10 @@
if (nxt == 0)
return cpu_in_cksum(m, len, off, 0);
+ if (__predict_false(off < sizeof(struct ip)))
+ PANIC("%s: offset %d too short for IP header %zu", __func__,
+ off, sizeof(struct ip));
+
/*
* Compute the equivalent of:
* struct ipovly ip;
Home |
Main Index |
Thread Index |
Old Index