]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more ND_TCHECK_n() macros
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 24 Nov 2017 19:44:53 +0000 (20:44 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 24 Nov 2017 19:44:53 +0000 (20:44 +0100)
print-cfm.c
print-egp.c
print-hncp.c
print-icmp.c
print-isoclns.c
print-ospf.c

index e764e1dc2a5e1f8c36d19d2069a382fded79f68e..2f570324eaf8f41341de19c9c6b8999f3d791933 100644 (file)
@@ -529,7 +529,7 @@ cfm_print(netdissect_options *ndo,
         cfm_tlv_header = (const struct cfm_tlv_header_t *)tptr;
 
         /* Enough to read the tlv type ? */
-        ND_TCHECK2(*tptr, 1);
+        ND_TCHECK_1(tptr);
         cfm_tlv_type=cfm_tlv_header->type;
 
         ND_PRINT((ndo, "\n\t%s TLV (0x%02x)",
index b0d3903cdfd7237921dc21d902334f8de5b17427..f4bd860efe5089e93c9dfc1a943dd72b637dbf0a 100644 (file)
@@ -182,7 +182,7 @@ egpnrprint(netdissect_options *ndo,
                length -= 4 - netlen;
                if (length < 1)
                        goto trunc;
-               ND_TCHECK2(cp[0], 1);
+               ND_TCHECK_1(cp);
                distances = EXTRACT_U_1(cp);
                cp++;
                length--;
@@ -195,7 +195,7 @@ egpnrprint(netdissect_options *ndo,
                while (distances != 0) {
                        if (length < 2)
                                goto trunc;
-                       ND_TCHECK2(cp[0], 2);
+                       ND_TCHECK_2(cp);
                        ND_PRINT((ndo, "%sd%d:", comma, EXTRACT_U_1(cp)));
                        cp++;
                        comma = ", ";
@@ -206,21 +206,21 @@ egpnrprint(netdissect_options *ndo,
                                /* Pickup network number */
                                if (length < 1)
                                        goto trunc;
-                               ND_TCHECK2(cp[0], 1);
+                               ND_TCHECK_1(cp);
                                addr = ((uint32_t) EXTRACT_U_1(cp)) << 24;
                                cp++;
                                length--;
                                if (IN_CLASSB(addr)) {
                                        if (length < 1)
                                                goto trunc;
-                                       ND_TCHECK2(cp[0], 1);
+                                       ND_TCHECK_1(cp);
                                        addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16;
                                        cp++;
                                        length--;
                                } else if (!IN_CLASSA(addr)) {
                                        if (length < 2)
                                                goto trunc;
-                                       ND_TCHECK2(cp[0], 2);
+                                       ND_TCHECK_2(cp);
                                        addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16;
                                        cp++;
                                        addr |= ((uint32_t) EXTRACT_U_1(cp)) << 8;
index 4057e5196f3e02bdf0d9513617afe8b50fea483e..560f5b7d7f496851f2e0e45a70b9603d6a19fd46 100644 (file)
@@ -422,7 +422,7 @@ hncp_print_rec(netdissect_options *ndo,
                 ND_PRINT((ndo, "\t"));
         }
 
-        ND_TCHECK2(*tlv, 4);
+        ND_TCHECK_4(tlv);
         if (i + 4 > length)
             goto invalid;
 
index b949ffb174d38cc32646fe01dd43a05748e73b27..2e76beb213ec852eabf20d068ccbeb759fc33760 100644 (file)
@@ -661,7 +661,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                 case 1:
                     switch(obj_ctype) {
                     case 1:
-                        ND_TCHECK2(*obj_tptr, 4);
+                        ND_TCHECK_4(obj_tptr);
                         raw_label = EXTRACT_BE_U_4(obj_tptr);
                         ND_PRINT((ndo, "\n\t    label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label)));
                         if (MPLS_STACK(raw_label))
index 2050517596616ccc74c2e0b05ae0931b6ce37ca4..e2d0aec7740e92665460ded9c4dce6fcc9e457b1 100644 (file)
@@ -902,7 +902,7 @@ clnp_print(netdissect_options *ndo,
                 ND_PRINT((ndo, ", bad opts/li"));
                 return (0);
             }
-            ND_TCHECK2(*pptr, 2);
+            ND_TCHECK_2(pptr);
             op = EXTRACT_U_1(pptr);
             opli = EXTRACT_U_1(pptr + 1);
             pptr += 2;
@@ -1313,7 +1313,7 @@ esis_print(netdissect_options *ndo,
                 ND_PRINT((ndo, ", bad opts/li"));
                 return;
             }
-            ND_TCHECK2(*pptr, 2);
+            ND_TCHECK_2(pptr);
             op = EXTRACT_U_1(pptr);
             opli = EXTRACT_U_1(pptr + 1);
             pptr += 2;
@@ -1334,7 +1334,7 @@ esis_print(netdissect_options *ndo,
 
             case ESIS_OPTION_ES_CONF_TIME:
                 if (opli == 2) {
-                    ND_TCHECK2(*pptr, 2);
+                    ND_TCHECK_2(pptr);
                     ND_PRINT((ndo, "%us", EXTRACT_BE_U_2(tptr)));
                 } else
                     ND_PRINT((ndo, "(bad length)"));
@@ -1411,7 +1411,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
 
   while (len > 2)
   {
-    ND_TCHECK2(*tptr, 2);
+    ND_TCHECK_2(tptr);
     stlv_type = EXTRACT_U_1(tptr);
     stlv_len  = EXTRACT_U_1(tptr + 1);
 
@@ -1532,7 +1532,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
 
   while (len > 2)
   {
-    ND_TCHECK2(*tptr, 2);
+    ND_TCHECK_2(tptr);
     stlv_type = EXTRACT_U_1(tptr);
     stlv_len  = EXTRACT_U_1(tptr + 1);
     tptr = tptr + 2;
@@ -2561,7 +2561,7 @@ isis_print(netdissect_options *ndo,
      */
 
     while (packet_len > 0) {
-       ND_TCHECK2(*pptr, 2);
+       ND_TCHECK_2(pptr);
        if (packet_len < 2)
            goto trunc;
        tlv_type = EXTRACT_U_1(pptr);
index b33d90c3ae36e87815364f3d4a780c7d0404a6e8..fd68325fb9aa610d1beed37a99f0676466be26f4 100644 (file)
@@ -187,7 +187,7 @@ ospf_print_grace_lsa(netdissect_options *ndo,
 
 
     while (ls_length > 0) {
-        ND_TCHECK2(*tptr, 4);
+        ND_TCHECK_4(tptr);
         if (ls_length < 4) {
             ND_PRINT((ndo, "\n\t    Remaining LS length %u < 4", ls_length));
             return -1;
@@ -274,7 +274,7 @@ ospf_print_te_lsa(netdissect_options *ndo,
     } bw;
 
     while (ls_length != 0) {
-        ND_TCHECK2(*tptr, 4);
+        ND_TCHECK_4(tptr);
         if (ls_length < 4) {
             ND_PRINT((ndo, "\n\t    Remaining LS length %u < 4", ls_length));
             return -1;
@@ -308,7 +308,7 @@ ospf_print_te_lsa(netdissect_options *ndo,
                            tlv_length));
                     return -1;
                 }
-                ND_TCHECK2(*tptr, 4);
+                ND_TCHECK_4(tptr);
                 subtlv_type = EXTRACT_BE_U_2(tptr);
                 subtlv_length = EXTRACT_BE_U_2(tptr + 2);
                 tptr+=4;
@@ -483,7 +483,7 @@ ospf_print_te_lsa(netdissect_options *ndo,
                 ND_PRINT((ndo, "\n\t    TLV length %u < 4", tlv_length));
                 return -1;
             }
-            ND_TCHECK2(*tptr, 4);
+            ND_TCHECK_4(tptr);
             ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr)));
             break;
 
@@ -803,7 +803,7 @@ ospf_print_lsa(netdissect_options *ndo,
                tptr = (const uint8_t *)(&lsap->lsa_un.un_ri_tlv.type);
 
                while (ls_length != 0) {
-                    ND_TCHECK2(*tptr, 4);
+                    ND_TCHECK_4(tptr);
                    if (ls_length < 4) {
                         ND_PRINT((ndo, "\n\t    Remaining LS length %u < 4", ls_length));
                         return(ls_end);