]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ldp.c
ATM LANE: Remove a redundant bounds check and add a bounds check
[tcpdump] / print-ldp.c
index b05a1218e484ae28de28c35a8d281b5f18db3b53..75e6dd2094ab4ee6a172b17c6f10ccbadadaa283 100644 (file)
@@ -309,7 +309,6 @@ ldp_tlv_print(netdissect_options *ndo,
         switch (af) {
         case AFNUM_INET:
            while(tlv_tlen >= sizeof(nd_ipv4)) {
-               ND_TCHECK_LEN(tptr, sizeof(nd_ipv4));
                ND_PRINT(" %s", GET_IPADDR_STRING(tptr));
                tlv_tlen-=sizeof(nd_ipv4);
                tptr+=sizeof(nd_ipv4);
@@ -317,7 +316,6 @@ ldp_tlv_print(netdissect_options *ndo,
             break;
         case AFNUM_INET6:
            while(tlv_tlen >= sizeof(nd_ipv6)) {
-               ND_TCHECK_LEN(tptr, sizeof(nd_ipv6));
                ND_PRINT(" %s", GET_IP6ADDR_STRING(tptr));
                tlv_tlen-=sizeof(nd_ipv6);
                tptr+=sizeof(nd_ipv6);
@@ -354,8 +352,8 @@ ldp_tlv_print(netdissect_options *ndo,
        case LDP_FEC_PREFIX:
            TLV_TCHECK(2);
            af = GET_BE_U_2(tptr);
-           tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
-           tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
+           tptr+=2;
+           tlv_tlen-=2;
            if (af == AFNUM_INET) {
                i=decode_prefix4(ndo, tptr, tlv_tlen, buf, sizeof(buf));
                if (i == -2)
@@ -540,8 +538,7 @@ ldp_tlv_print(netdissect_options *ndo,
     return(tlv_len+4); /* Type & Length fields not included */
 
 trunc:
-    nd_print_trunc(ndo);
-    return 0;
+    nd_trunc_longjmp(ndo);
 
 invalid:
     return(tlv_len+4); /* Type & Length fields not included */
@@ -699,6 +696,5 @@ ldp_pdu_print(netdissect_options *ndo,
     }
     return pdu_len+4;
 trunc:
-    nd_print_trunc(ndo);
-    return 0;
+    nd_trunc_longjmp(ndo);
 }