X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/1a90fd99d279d63242419a30ba3e0720872bff75..1a04b92e365f5ed01ca38619b41bcc4fc9cbd63c:/print-stp.c diff --git a/print-stp.c b/print-stp.c index 66b6d0cd..1a254c3d 100644 --- a/print-stp.c +++ b/print-stp.c @@ -84,7 +84,7 @@ static const struct tok rstp_obj_port_role_values[] = { { 0, NULL} }; -#define ND_TCHECK_BRIDGE_ID(p) ND_TCHECK2(*(p), 8) +#define ND_TCHECK_BRIDGE_ID(p) ND_TCHECK_8(p) static char * stp_print_bridge_id(const u_char *p) @@ -93,7 +93,9 @@ stp_print_bridge_id(const u_char *p) snprintf(bridge_id_str, sizeof(bridge_id_str), "%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", - p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); + EXTRACT_U_1(p), EXTRACT_U_1(p + 1), EXTRACT_U_1(p + 2), + EXTRACT_U_1(p + 3), EXTRACT_U_1(p + 4), EXTRACT_U_1(p + 5), + EXTRACT_U_1(p + 6), EXTRACT_U_1(p + 7)); return bridge_id_str; } @@ -303,7 +305,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_PRINT((ndo, "\n\tCIST bridge-id %s, ", stp_print_bridge_id(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET))); - ND_TCHECK(ptr[MST_BPDU_CIST_REMAIN_HOPS_OFFSET]); + ND_TCHECK_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET); ND_PRINT((ndo, "CIST remaining-hops %d", EXTRACT_U_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET))); /* Dump all MSTI's */ @@ -313,7 +315,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, len = v3len - MST_BPDU_CONFIG_INFO_LENGTH; offset = MST_BPDU_MSTI_OFFSET; while (len >= MST_BPDU_MSTI_LENGTH) { - ND_TCHECK2(*(ptr + offset), MST_BPDU_MSTI_LENGTH); + ND_TCHECK_LEN(ptr + offset, MST_BPDU_MSTI_LENGTH); msti = EXTRACT_BE_U_2(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET); msti = msti & 0x0FFF;