]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp6.c
Fix spaces
[tcpdump] / print-icmp6.c
index 81d7af2808c8c7a47e9b44541730e04b1d0696a7..ce56999589600764c5ace843ca09091793269c2b 100644 (file)
@@ -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