]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ldp: use a constant 2, not LDP_TLV_ADDRESS_LIST_AFNUM_LEN.
authorGuy Harris <[email protected]>
Wed, 27 May 2020 05:15:50 +0000 (22:15 -0700)
committerGuy Harris <[email protected]>
Wed, 27 May 2020 05:15:50 +0000 (22:15 -0700)
We already use GET_BE_U_2(), and use 2 in the TLV_TCHECK() call; this
makes it a bit more obvious (if you read TLV_TCHECK()) that the test
makes sure we can subtract from tlv_tlen without underflowing.

print-ldp.c

index b05a1218e484ae28de28c35a8d281b5f18db3b53..b57244509373f810fd893c726d1ddaf9e5606c8e 100644 (file)
@@ -354,8 +354,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)