Skip to content

Commit 351c0ad

Browse files
committed
ldp: use a constant 2, not LDP_TLV_ADDRESS_LIST_AFNUM_LEN.
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.
1 parent a225ce3 commit 351c0ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

print-ldp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ ldp_tlv_print(netdissect_options *ndo,
354354
case LDP_FEC_PREFIX:
355355
TLV_TCHECK(2);
356356
af = GET_BE_U_2(tptr);
357-
tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
358-
tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
357+
tptr+=2;
358+
tlv_tlen-=2;
359359
if (af == AFNUM_INET) {
360360
i=decode_prefix4(ndo, tptr, tlv_tlen, buf, sizeof(buf));
361361
if (i == -2)

0 commit comments

Comments
 (0)