X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/0cced4fcdcad0c011cb123371d557067da7c6bbe..a8abce5c5e2dce2ba6dbccd5d3829da104b80f9c:/print-icmp6.c diff --git a/print-icmp6.c b/print-icmp6.c index 81d7af28..ce569995 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -1039,6 +1039,11 @@ icmp6_print(netdissect_options *ndo, oip = (const struct ip6_hdr *)(dp + 1); /* 'ep' points to the end of available data. */ ep = ndo->ndo_snapend; + if (length == 0) { + ND_PRINT("ICMP6, length 0"); + ND_PRINT("%s", istr); + return; + } if (ndo->ndo_vflag && !fragmented) { uint16_t sum, udp_sum; @@ -1194,7 +1199,7 @@ icmp6_print(netdissect_options *ndo, p = (const struct nd_router_advert *)dp; ND_TCHECK_4(p->nd_ra_retransmit); ND_PRINT("\n\thop limit %u, Flags [%s]" - ", pref %s, router lifetime %us, reachable time %us, retrans time %us", + ", pref %s, router lifetime %us, reachable time %ums, retrans timer %ums", EXTRACT_U_1(p->nd_ra_curhoplimit), bittok2str(icmp6_opt_ra_flag_values,"none",EXTRACT_U_1(p->nd_ra_flags_reserved)), get_rtpref(EXTRACT_U_1(p->nd_ra_flags_reserved)), @@ -1417,8 +1422,6 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) size_t l; u_int i; -#define ECHECK(var) if ((const u_char *)&(var) > ep - sizeof(var)) return - cp = bp; /* 'ep' points to the end of available data. */ ep = ndo->ndo_snapend; @@ -1426,7 +1429,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) while (cp < ep) { op = (const struct nd_opt_hdr *)cp; - ECHECK(op->nd_opt_len); + ND_TCHECK_1(op->nd_opt_len); if (resid <= 0) return; opt_type = EXTRACT_U_1(op->nd_opt_type); @@ -1492,7 +1495,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) while (domp < cp + (opt_len << 3) && EXTRACT_U_1(domp) != '\0') { ND_PRINT(" "); - if ((domp = ns_nprint (ndo, domp, bp)) == NULL) + if ((domp = ns_nprint(ndo, domp, bp)) == NULL) goto trunc; } break; @@ -1551,7 +1554,6 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) trunc: ND_PRINT("[ndp opt]"); return; -#undef ECHECK } static void