summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/print-ip.c
diff options
context:
space:
mode:
authormoritz <moritz@openbsd.org>2006-06-01 17:18:38 +0000
committermoritz <moritz@openbsd.org>2006-06-01 17:18:38 +0000
commite3fcc7855dd805d552d12639976fb3e2e2040aac (patch)
tree1521b7099455fe8ab6cff4d00f3de4214c54e336 /usr.sbin/tcpdump/print-ip.c
parentBetter to attach obio devices after pci. (diff)
downloadwireguard-openbsd-e3fcc7855dd805d552d12639976fb3e2e2040aac.tar.xz
wireguard-openbsd-e3fcc7855dd805d552d12639976fb3e2e2040aac.zip
Pass the captured packet length in addition to the real packet length
to etherip_print() and do all the bounds checking with it. Also add bounds checks to ether_print(). This fixes even more crashes. ok canacar@
Diffstat (limited to 'usr.sbin/tcpdump/print-ip.c')
-rw-r--r--usr.sbin/tcpdump/print-ip.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c
index 6d1357fedc9..22075ec1755 100644
--- a/usr.sbin/tcpdump/print-ip.c
+++ b/usr.sbin/tcpdump/print-ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ip.c,v 1.31 2006/05/29 20:41:41 moritz Exp $ */
+/* $OpenBSD: print-ip.c,v 1.32 2006/06/01 17:18:39 moritz Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-ip.c,v 1.31 2006/05/29 20:41:41 moritz Exp $ (LBL)";
+ "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-ip.c,v 1.32 2006/06/01 17:18:39 moritz Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -542,7 +542,8 @@ ip_print(register const u_char *bp, register u_int length)
#define IPPROTO_ETHERIP 97
#endif
case IPPROTO_ETHERIP:
- etherip_print(cp, len, (const u_char *)ip);
+ etherip_print(cp, snapend - cp, len,
+ (const u_char *)ip);
break;
#ifndef IPPROTO_IPCOMP