summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/tcpdump/print-ip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c
index b039cee3c00..254ace611fc 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.46 2016/10/30 04:03:29 jsg Exp $ */
+/* $OpenBSD: print-ip.c,v 1.47 2016/10/30 04:10:21 jsg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -416,6 +416,8 @@ ip_print(const u_char *bp, u_int length)
off = ntohs(ip->ip_off);
if ((off & 0x1fff) == 0) {
cp = (const u_char *)ip + hlen;
+ if (cp > snapend)
+ goto trunc;
switch (ip->ip_p) {
case IPPROTO_TCP: