summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/tcpdump/print-ip.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c
index b96e0fd7030..15ea80e0cf3 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.15 2001/02/15 16:16:48 niklas Exp $ */
+/* $OpenBSD: print-ip.c,v 1.16 2002/04/10 10:22:59 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ip.c,v 1.15 2001/02/15 16:16:48 niklas Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-ip.c,v 1.16 2002/04/10 10:22:59 deraadt Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -394,6 +394,10 @@ ip_print(register const u_char *bp, register u_int length)
return;
}
hlen = ip->ip_hl * 4;
+ if (hlen < sizeof(struct ip)) {
+ (void)printf("bad-hlen %d", hlen);
+ return;
+ }
len = ntohs(ip->ip_len);
if (length < len)