diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-08-10 16:22:37 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-09-05 14:59:21 +0200 |
commit | 929e4be621ebdcede37865a5767a175f083f9138 (patch) | |
tree | bf6ecbc038696e66176b2d50e04e015767f23b3d /print-ip.c | |
parent | 54b5db3dde658894be730b15480f9b6e27b717a0 (diff) | |
download | tcpdump-test-rc.tar.gz |
Remove many (761) redundant ND_TCHECK_n() callstest-rc
ND_TCHECK_n(e), n in { 1, 2, 3, 4, 8 }.
They are redundant because they are followed by a GET_.*_n(e) call,
same n, same e, which do the bounds check.
Remove unused 'trunc' labels and most associated codes.
Update the outputs of some tests accordingly.
Diffstat (limited to 'print-ip.c')
-rw-r--r-- | print-ip.c | 14 |
1 files changed, 0 insertions, 14 deletions
@@ -66,7 +66,6 @@ ip_printroute(netdissect_options *ndo, } if ((length + 1) & 3) ND_PRINT(" [bad length %u]", length); - ND_TCHECK_1(cp + 2); ptr = GET_U_1(cp + 2) - 1; if (ptr < 3 || ((ptr + 1) & 3) || ptr > length + 1) ND_PRINT(" [bad ptr %u]", GET_U_1(cp + 2)); @@ -107,14 +106,12 @@ ip_finddst(netdissect_options *ndo, for (; length != 0; cp += len, length -= len) { int tt; - ND_TCHECK_1(cp); tt = GET_U_1(cp); if (tt == IPOPT_EOL) break; else if (tt == IPOPT_NOP) len = 1; else { - ND_TCHECK_1(cp + 1); len = GET_U_1(cp + 1); if (len < 2) break; @@ -183,16 +180,13 @@ ip_printts(netdissect_options *ndo, return (0); } ND_PRINT(" TS{"); - ND_TCHECK_1(cp + 3); hoplen = ((GET_U_1(cp + 3) & 0xF) != IPOPT_TS_TSONLY) ? 8 : 4; if ((length - 4) & (hoplen-1)) ND_PRINT("[bad length %u]", length); - ND_TCHECK_1(cp + 2); ptr = GET_U_1(cp + 2) - 1; len = 0; if (ptr < 4 || ((ptr - 4) & (hoplen-1)) || ptr > length + 1) ND_PRINT("[bad ptr %u]", GET_U_1(cp + 2)); - ND_TCHECK_1(cp + 3); switch (GET_U_1(cp + 3)&0xF) { case IPOPT_TS_TSONLY: ND_PRINT("TSONLY"); @@ -257,7 +251,6 @@ ip_optprint(netdissect_options *ndo, ND_PRINT("%s", sep); sep = ","; - ND_TCHECK_1(cp); option_code = GET_U_1(cp); ND_PRINT("%s", @@ -268,7 +261,6 @@ ip_optprint(netdissect_options *ndo, option_len = 1; else { - ND_TCHECK_1(cp + 1); option_len = GET_U_1(cp + 1); if (option_len < 2) { ND_PRINT(" [bad length %u]", option_len); @@ -531,7 +523,6 @@ ipN_print(netdissect_options *ndo, const u_char *bp, u_int length) return; } - ND_TCHECK_1(bp); switch (GET_U_1(bp) & 0xF0) { case 0x40: ip_print(ndo, bp, length); @@ -543,9 +534,4 @@ ipN_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_PRINT("unknown ip %u", (GET_U_1(bp) & 0xF0) >> 4); break; } - return; - -trunc: - nd_print_trunc(ndo); - return; } |