Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/tcpdump don't try to parse packets with short iphlen.



details:   https://anonhg.NetBSD.org/src/rev/a4c947d877cd
branches:  trunk
changeset: 481676:a4c947d877cd
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Feb 03 17:42:01 2000 +0000

description:
don't try to parse packets with short iphlen.
From: tcpdump.org (bugtraq june 99)

diffstat:

 usr.sbin/tcpdump/print-ip.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 0baeed819871 -r a4c947d877cd usr.sbin/tcpdump/print-ip.c
--- a/usr.sbin/tcpdump/print-ip.c       Thu Feb 03 16:56:23 2000 +0000
+++ b/usr.sbin/tcpdump/print-ip.c       Thu Feb 03 17:42:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print-ip.c,v 1.9 1999/08/26 14:52:04 itojun Exp $      */
+/*     $NetBSD: print-ip.c,v 1.10 2000/02/03 17:42:01 itojun Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
 static const char rcsid[] =
     "@(#) Header: print-ip.c,v 1.66 97/05/28 12:51:43 leres Exp  (LBL)";
 #else
-__RCSID("$NetBSD: print-ip.c,v 1.9 1999/08/26 14:52:04 itojun Exp $");
+__RCSID("$NetBSD: print-ip.c,v 1.10 2000/02/03 17:42:01 itojun Exp $");
 #endif
 #endif
 
@@ -384,6 +384,10 @@
                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)



Home | Main Index | Thread Index | Old Index