X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/3824a6c0417a551961d1a1bf4f94f10eff736afc..ad87e9495c5c5ecdbb38b7ad76e9c54d7e9852ac:/print-igmp.c diff --git a/print-igmp.c b/print-igmp.c index 156780aa..a8485629 100644 --- a/print-igmp.c +++ b/print-igmp.c @@ -19,6 +19,10 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#ifndef lint +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.15 2004-03-24 00:59:16 guy Exp $ (LBL)"; +#endif #ifdef HAVE_CONFIG_H #include "config.h" @@ -33,10 +37,6 @@ #include "addrtoname.h" #include "extract.h" /* must come after interface.h */ -#ifndef lint -static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.12 2003-11-15 00:39:26 guy Exp $ (LBL)"; -#endif #ifndef IN_CLASSD #define IN_CLASSD(i) (((int32_t)(i) & 0xf0000000) == 0xe0000000) #endif @@ -218,6 +218,7 @@ print_igmpv3_query(register const u_char *bp, register u_int len) (void)printf(" [invalid len %d]", len); return; } + TCHECK(bp[1]); mrc = bp[1]; if (mrc < 128) { mrt = mrc; @@ -263,19 +264,21 @@ igmp_print(register const u_char *bp, register u_int len) return; } - TCHECK2(bp[0], 8); + TCHECK(bp[0]); switch (bp[0]) { case 0x11: (void)printf("igmp query"); if (len >= 12) print_igmpv3_query(bp, len); else { + TCHECK(bp[1]); if (bp[1]) { (void)printf(" v2"); if (bp[1] != 100) (void)printf(" [max resp time %d]", bp[1]); } else (void)printf(" v1"); + TCHECK2(bp[4], 4); if (EXTRACT_32BITS(&bp[4])) (void)printf(" [gaddr %s]", ipaddr_string(&bp[4])); if (len != 8) @@ -283,11 +286,13 @@ igmp_print(register const u_char *bp, register u_int len) } break; case 0x12: + TCHECK2(bp[4], 4); (void)printf("igmp v1 report %s", ipaddr_string(&bp[4])); if (len != 8) (void)printf(" [len %d]", len); break; case 0x16: + TCHECK2(bp[4], 4); (void)printf("igmp v2 report %s", ipaddr_string(&bp[4])); break; case 0x22: @@ -295,6 +300,7 @@ igmp_print(register const u_char *bp, register u_int len) print_igmpv3_report(bp, len); break; case 0x17: + TCHECK2(bp[4], 4); (void)printf("igmp leave %s", ipaddr_string(&bp[4])); break; case 0x13: