]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pim.c
Add some additional bounds checking.
[tcpdump] / print-pim.c
index ea7d8fed25189c9cf58239c415aa083741510b43..82c19f2ab88704f2bedab75e24b4834c3829daa3 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.42 2004-03-18 14:12:18 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.44 2004-09-29 16:49:31 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -163,6 +163,7 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len)
        while (ngroups--) {
                TCHECK2(bp[0], 4);
                (void)printf("\n\tGroup: %s", ipaddr_string(bp));
+               TCHECK2(bp[4], 4);
                if (EXTRACT_32BITS(&bp[4]) != 0xffffffff)
                        (void)printf("/%s", ipaddr_string(&bp[4]));
                TCHECK2(bp[8], 4);
@@ -414,18 +415,16 @@ pim_print(register const u_char *bp, register u_int len)
        switch (PIM_VER(pim->pim_typever)) {
        case 2:
             if (!vflag) {
-                printf("PIMv%u, %s (%u), length: %u",
+                printf("PIMv%u, %s, length: %u",
                        PIM_VER(pim->pim_typever),
                        tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
-                       PIM_TYPE(pim->pim_typever),
                        len);
                 return;
             } else {
-                printf("PIMv%u, length: %u\n\t%s (%u)",
+                printf("PIMv%u, length: %u\n\t%s",
                        PIM_VER(pim->pim_typever),
                        len,
-                       tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
-                       PIM_TYPE(pim->pim_typever));
+                       tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)));
                 pimv2_print(bp, len);
             }
             break;