X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ef3437c081dd78bd51fad6ed0d6af58dcfaabd69..c56f25c54b87b3edaced56578721c72d7ca9795d:/print-ip.c?ds=sidebyside diff --git a/print-ip.c b/print-ip.c index 0974fbad..b9d39cf5 100644 --- a/print-ip.c +++ b/print-ip.c @@ -68,7 +68,7 @@ ip_printroute(netdissect_options *ndo, if ((length + 1) & 3) ND_PRINT((ndo, " [bad length %u]", length)); ND_TCHECK_1(cp + 2); - ptr = cp[2] - 1; + ptr = EXTRACT_U_1(cp + 2) - 1; if (ptr < 3 || ((ptr + 1) & 3) || ptr > length + 1) ND_PRINT((ndo, " [bad ptr %u]", EXTRACT_U_1(cp + 2))); @@ -114,7 +114,7 @@ ip_finddst(netdissect_options *ndo, len = 1; else { ND_TCHECK_1(cp + 1); - len = cp[1]; + len = EXTRACT_U_1(cp + 1); if (len < 2) break; } @@ -182,11 +182,12 @@ ip_printts(netdissect_options *ndo, return (0); } ND_PRINT((ndo, " TS{")); - hoplen = ((cp[3]&0xF) != IPOPT_TS_TSONLY) ? 8 : 4; + ND_TCHECK_1(cp + 3); + hoplen = ((EXTRACT_U_1(cp + 3) & 0xF) != IPOPT_TS_TSONLY) ? 8 : 4; if ((length - 4) & (hoplen-1)) ND_PRINT((ndo, "[bad length %u]", length)); ND_TCHECK_1(cp + 2); - ptr = cp[2] - 1; + ptr = EXTRACT_U_1(cp + 2) - 1; len = 0; if (ptr < 4 || ((ptr - 4) & (hoplen-1)) || ptr > length + 1) ND_PRINT((ndo, "[bad ptr %u]", EXTRACT_U_1(cp + 2))); @@ -266,7 +267,7 @@ ip_optprint(netdissect_options *ndo, else { ND_TCHECK_1(cp + 1); - option_len = cp[1]; + option_len = EXTRACT_U_1(cp + 1); if (option_len < 2) { ND_PRINT((ndo, " [bad length %u]", option_len)); return;