X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/d3d90f29e50f07c62e58b30016bf169fc96e5b54..dbd0cbc147d140e9bd34eefa7b66a17f691d49e0:/print-cdp.c diff --git a/print-cdp.c b/print-cdp.c index a0cdf2a3..f8f4427c 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.23 2004-03-24 00:41:13 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.25 2004-10-07 14:53:11 hannes Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -41,6 +41,7 @@ static const char rcsid[] _U_ = #include "interface.h" #include "addrtoname.h" #include "extract.h" /* must come after interface.h */ +#include "nlpid.h" #define CDP_HEADER_LEN 4 @@ -243,11 +244,12 @@ cdp_print_addr(const u_char * p, int l) }; #endif + TCHECK2(*p, 2); num = EXTRACT_32BITS(p); p += 4; while (p < endp && num >= 0) { - TCHECK2(p, 2); + TCHECK2(*p, 2); if (p + 2 > endp) goto trunc; pt = p[0]; /* type of "protocol" field */ @@ -259,7 +261,7 @@ cdp_print_addr(const u_char * p, int l) goto trunc; al = EXTRACT_16BITS(&p[pl]); /* address length */ - if (pt == PT_NLPID && pl == 1 && *p == 0xcc && al == 4) { + if (pt == PT_NLPID && pl == 1 && *p == NLPID_IP && al == 4) { /* * IPv4: protocol type = NLPID, protocol length = 1 * (1-byte NLPID), protocol = 0xcc (NLPID for IPv4),