From: Denis Ovsienko Date: Sat, 19 Sep 2020 01:24:12 +0000 (+0100) Subject: OpenFlow 1.0: Lose 4 more ND_TCHECK_LEN() calls. X-Git-Tag: tcpdump-4.99-bp~215 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/14dc193fed788d1d7d591dd335ace843e4800e7b OpenFlow 1.0: Lose 4 more ND_TCHECK_LEN() calls. ND_TCHECK_LEN() just before an unconditional GET_ETHERADDR_STRING() is excess. ND_TCHECK_LEN() just before a conditional GET_ETHERADDR_STRING() can be removed where there is a subsequent unconditional GET_ call (this is not specific to GET_ETHERADDR_STRING(), for example, unconditional fetch of "dl_type" makes sure that it is safe to have the fetch of "dl_vlan_pcp" conditional). --- diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index 1888e24f..409b59e2 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -1137,7 +1137,6 @@ of10_phy_ports_print(netdissect_options *ndo, tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* hw_addr */ - ND_TCHECK_LEN(cp, MAC_ADDR_LEN); ND_PRINT(", hw_addr %s", GET_ETHERADDR_STRING(cp)); cp += MAC_ADDR_LEN; /* name */ @@ -1330,12 +1329,10 @@ of10_match_print(netdissect_options *ndo, tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* dl_src */ - ND_TCHECK_LEN(cp, MAC_ADDR_LEN); if (! (wildcards & OFPFW_DL_SRC)) ND_PRINT("%smatch dl_src %s", pfx, GET_ETHERADDR_STRING(cp)); cp += MAC_ADDR_LEN; /* dl_dst */ - ND_TCHECK_LEN(cp, MAC_ADDR_LEN); if (! (wildcards & OFPFW_DL_DST)) ND_PRINT("%smatch dl_dst %s", pfx, GET_ETHERADDR_STRING(cp)); cp += MAC_ADDR_LEN; @@ -1494,7 +1491,6 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_DL_SRC: case OFPAT_SET_DL_DST: /* dl_addr */ - ND_TCHECK_LEN(cp, MAC_ADDR_LEN); ND_PRINT(", dl_addr %s", GET_ETHERADDR_STRING(cp)); cp += MAC_ADDR_LEN; /* pad */