From: Francois-Xavier Le Bail Date: Sat, 23 Feb 2019 18:55:18 +0000 (+0100) Subject: GeoNet: Replace the ND_TTEST_*() calls with ND_TCHECK_*() calls X-Git-Tag: tcpdump-4.99-bp~930 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/5b8c5e94fec3fec7b26e774db8656de2d8a15363 GeoNet: Replace the ND_TTEST_*() calls with ND_TCHECK_*() calls Moreover: Add two comments --- diff --git a/print-geonet.c b/print-geonet.c index d1508774..af3f1ec9 100644 --- a/print-geonet.c +++ b/print-geonet.c @@ -64,6 +64,7 @@ print_btp_body(netdissect_options *ndo, const char *msg_type_str; /* Assuming ItsDpuHeader */ + /* 2 bytes ND_TCHECKed in geonet_print() */ version = EXTRACT_U_1(bp); msg_type = EXTRACT_U_1(bp + 1); msg_type_str = tok2str(msg_type_values, "unknown (%u)", msg_type); @@ -75,6 +76,7 @@ static void print_btp(netdissect_options *ndo, const u_char *bp) { + /* 4 bytes ND_TCHECKed in geonet_print() */ uint16_t dest = EXTRACT_BE_U_2(bp + 0); uint16_t src = EXTRACT_BE_U_2(bp + 2); ND_PRINT("; BTP Dst:%u Src:%u", dest, src); @@ -86,17 +88,17 @@ print_long_pos_vector(netdissect_options *ndo, { uint32_t lat, lon; - if (!ND_TTEST_LEN(bp, GEONET_ADDR_LEN)) - return (-1); + ND_TCHECK_LEN(bp, GEONET_ADDR_LEN); ND_PRINT("GN_ADDR:%s ", linkaddr_string (ndo, bp, 0, GEONET_ADDR_LEN)); - if (!ND_TTEST_8(bp + 12)) - return (-1); + ND_TCHECK_8(bp + 12); lat = EXTRACT_BE_U_4(bp + 12); ND_PRINT("lat:%u ", lat); lon = EXTRACT_BE_U_4(bp + 16); ND_PRINT("lon:%u", lon); return (0); +trunc: + return -1; }