]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp6.c
Use more the EXTRACT_U_1() macro (40/n)
[tcpdump] / print-icmp6.c
index bf17993cc650e4d935bd57ddc90cc9a6c0c7b897..761b3779e6f2c75b9744ffa97626120b77be1f8e 100644 (file)
@@ -1322,7 +1322,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                        ND_PRINT((ndo," lifetime %us, domain(s):",
                                   EXTRACT_BE_U_4(&opds->nd_opt_dnssl_lifetime)));
                        domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */
-                       while (domp < cp + (op->nd_opt_len << 3) && *domp != '\0')
+                       while (domp < cp + (op->nd_opt_len << 3) && EXTRACT_U_1(domp) != '\0')
                        {
                                ND_PRINT((ndo, " "));
                                if ((domp = ns_nprint (ndo, domp, bp)) == NULL)
@@ -1350,7 +1350,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                        case 1:
                                break;
                        case 2:
-                               ND_TCHECK2(*in6p, 8);
+                               ND_TCHECK_8(in6p);
                                memcpy(&in6, opri + 1, 8);
                                break;
                        case 3:
@@ -1430,7 +1430,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
                     return;
            }
             ND_TCHECK2(bp[group + 4], sizeof(struct in6_addr));
-            ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, &bp[group + 4])));
+            ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + group + 4)));
            ND_PRINT((ndo," %s", tok2str(mldv2report2str, " [v2-report-#%d]",
                                          EXTRACT_U_1(bp + group))));
             nsrcs = (bp[group + 2] << 8) + bp[group + 3];
@@ -1447,7 +1447,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
                 for (j = 0; j < nsrcs; j++) {
                     ND_TCHECK2(bp[group + 20 + j * sizeof(struct in6_addr)],
                             sizeof(struct in6_addr));
-                   ND_PRINT((ndo," %s", ip6addr_string(ndo, &bp[group + 20 + j * sizeof(struct in6_addr)])));
+                   ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + group + 20 + (j * sizeof(struct in6_addr)))));
                }
                 ND_PRINT((ndo," }"));
             }
@@ -1487,7 +1487,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
             ND_PRINT((ndo," [max resp delay=%d]", mrt));
     }
     ND_TCHECK2(bp[8], sizeof(struct in6_addr));
-    ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, &bp[8])));
+    ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + 8)));
 
     if (ndo->ndo_vflag) {
         ND_TCHECK(bp[25]);
@@ -1495,7 +1495,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
                ND_PRINT((ndo," sflag"));
        }
        if (bp[24] & 0x07) {
-               ND_PRINT((ndo," robustness=%d", bp[24] & 0x07));
+               ND_PRINT((ndo," robustness=%d", EXTRACT_U_1(bp + 24) & 0x07));
        }
        if (bp[25] < 128) {
                qqi = bp[25];
@@ -1515,7 +1515,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
            for (i = 0; i < nsrcs; i++) {
                ND_TCHECK2(bp[28 + i * sizeof(struct in6_addr)],
                         sizeof(struct in6_addr));
-               ND_PRINT((ndo," %s", ip6addr_string(ndo, &bp[28 + i * sizeof(struct in6_addr)])));
+               ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + 28 + (i * sizeof(struct in6_addr)))));
            }
            ND_PRINT((ndo," }"));
        } else
@@ -1544,7 +1544,7 @@ dnsname_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
                                break;
                        }
                        while (i-- && cp < ep) {
-                               safeputchar(ndo, *cp);
+                               safeputchar(ndo, EXTRACT_U_1(cp));
                                cp++;
                        }
                        if (cp + 1 < ep && EXTRACT_U_1(cp))
@@ -1666,7 +1666,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                                cp++;
                                ND_PRINT((ndo,", \""));
                                while (cp < ep) {
-                                       safeputchar(ndo, *cp);
+                                       safeputchar(ndo, EXTRACT_U_1(cp));
                                        cp++;
                                }
                                ND_PRINT((ndo,"\""));
@@ -1764,7 +1764,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                                cp++;
                                ND_PRINT((ndo,", \""));
                                while (cp < ep) {
-                                       safeputchar(ndo, *cp);
+                                       safeputchar(ndo, EXTRACT_U_1(cp));
                                        cp++;
                                }
                                ND_PRINT((ndo,"\""));