diff options
author | fenner <fenner@FreeBSD.org> | 2003-03-02 08:22:26 +0000 |
---|---|---|
committer | fenner <fenner@FreeBSD.org> | 2003-03-02 08:22:26 +0000 |
commit | 5f76ebca43302f98858e83a6212d9c610e939bad (patch) | |
tree | c244ceda18deb5fc8e576971e1e83b7b631f5219 /contrib/tcpdump/print-isakmp.c | |
parent | 24ede2d805a7ffac09999aafe7d4f285e45a6edd (diff) | |
download | FreeBSD-src-5f76ebca43302f98858e83a6212d9c610e939bad.zip FreeBSD-src-5f76ebca43302f98858e83a6212d9c610e939bad.tar.gz |
Import tcpdump 3.7.2 (fudging for multi-DLT support) from
http://www.tcpdump.org/release/tcpdump-3.7.2.tar.gz
Diffstat (limited to 'contrib/tcpdump/print-isakmp.c')
-rw-r--r-- | contrib/tcpdump/print-isakmp.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/contrib/tcpdump/print-isakmp.c b/contrib/tcpdump/print-isakmp.c index 909f0b95..6e5c58d 100644 --- a/contrib/tcpdump/print-isakmp.c +++ b/contrib/tcpdump/print-isakmp.c @@ -30,7 +30,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.29 2001/10/26 03:41:29 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.29.2.2 2003/02/26 05:58:39 fenner Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -43,9 +43,6 @@ static const char rcsid[] = #include <sys/time.h> #include <sys/socket.h> -struct mbuf; -struct rtentry; - #include <netinet/in.h> #include <stdio.h> @@ -1028,6 +1025,7 @@ isakmp_sub0_print(u_char np, struct isakmp_gen *ext, u_char *ep, { u_char *cp; struct isakmp_gen e; + u_int item_len; cp = (u_char *)ext; safememcpy(&e, ext, sizeof(e)); @@ -1036,7 +1034,16 @@ isakmp_sub0_print(u_char np, struct isakmp_gen *ext, u_char *ep, cp = (*NPFUNC(np))(ext, ep, phase, doi, proto); else { printf("%s", NPSTR(np)); - cp += ntohs(e.len); + item_len = ntohs(e.len); + if (item_len == 0) { + /* + * We don't want to loop forever processing this + * bogus (zero-length) item; return NULL so that + * we stop dissecting. + */ + cp = NULL; + } else + cp += item_len; } return cp; } @@ -1069,6 +1076,11 @@ isakmp_sub_print(u_char np, struct isakmp_gen *ext, u_char *ep, printf(")"); depth--; + if (cp == NULL) { + /* Zero-length subitem */ + return NULL; + } + np = e.np; ext = (struct isakmp_gen *)cp; } |