]> The Tcpdump Group git mirrors - tcpdump/commitdiff
spell "%s" format strings (complements 708a68a)
authorDenis Ovsienko <[email protected]>
Mon, 31 Mar 2014 11:36:01 +0000 (15:36 +0400)
committerDenis Ovsienko <[email protected]>
Mon, 31 Mar 2014 11:43:22 +0000 (15:43 +0400)
Make "%s" format string always reside in the print function call
explicitly such that the reader doesn't have to assess its safety.

print-atalk.c
print-bootp.c
print-krb.c
print-ospf6.c
print-tftp.c
print-wb.c

index 00f9dac4a7c55e4c01ee3cea499de0075aa71c25..732e61128a792b8ac9ed628e993e3c6069f1c40c 100644 (file)
@@ -254,7 +254,7 @@ atp_print(netdissect_options *ndo,
 
        if ((const u_char *)(ap + 1) > ndo->ndo_snapend) {
                /* Just bail if we don't have the whole chunk. */
-               ND_PRINT((ndo, tstr));
+               ND_PRINT((ndo, "%s", tstr));
                return;
        }
        if (length < sizeof(*ap)) {
@@ -398,7 +398,7 @@ nbp_print(netdissect_options *ndo,
        /* ep points to end of available data */
        ep = ndo->ndo_snapend;
        if ((const u_char *)tp > ep) {
-               ND_PRINT((ndo, tstr));
+               ND_PRINT((ndo, "%s", tstr));
                return;
        }
        switch (i = np->control & 0xf0) {
@@ -407,7 +407,7 @@ nbp_print(netdissect_options *ndo,
        case nbpLkUp:
                ND_PRINT((ndo, i == nbpLkUp? " nbp-lkup %d:":" nbp-brRq %d:", np->id));
                if ((const u_char *)(tp + 1) > ep) {
-                       ND_PRINT((ndo, tstr));
+                       ND_PRINT((ndo, "%s", tstr));
                        return;
                }
                (void)nbp_name_print(ndo, tp, ep);
@@ -449,7 +449,7 @@ print_cstring(netdissect_options *ndo,
        register u_int length;
 
        if (cp >= (const char *)ep) {
-               ND_PRINT((ndo, tstr));
+               ND_PRINT((ndo, "%s", tstr));
                return (0);
        }
        length = *cp++;
@@ -461,7 +461,7 @@ print_cstring(netdissect_options *ndo,
        }
        while ((int)--length >= 0) {
                if (cp >= (const char *)ep) {
-                       ND_PRINT((ndo, tstr));
+                       ND_PRINT((ndo, "%s", tstr));
                        return (0);
                }
                ND_PRINT((ndo, "%c", *cp++));
@@ -477,7 +477,7 @@ nbp_tuple_print(netdissect_options *ndo,
        register const struct atNBPtuple *tpn;
 
        if ((const u_char *)(tp + 1) > ep) {
-               ND_PRINT((ndo, tstr));
+               ND_PRINT((ndo, "%s", tstr));
                return 0;
        }
        tpn = nbp_name_print(ndo, tp, ep);
index f41f2ea844597961e83c45ee0be9fa9692e2742a..103337000bb059265be1055006ad409317f62570 100644 (file)
@@ -167,7 +167,7 @@ bootp_print(netdissect_options *ndo,
 
        return;
 trunc:
-       ND_PRINT((ndo, tstr));
+       ND_PRINT((ndo, "%s", tstr));
 }
 
 /*
@@ -799,7 +799,7 @@ cmu_print(netdissect_options *ndo,
        return;
 
 trunc:
-       ND_PRINT((ndo, tstr));
+       ND_PRINT((ndo, "%s", tstr));
 #undef PRINTCMUADDR
 }
 
index e726cee9981175b1e81013c793c7139fe2eda7eb..bcc81bf125796a4c58a792d278b386b078df3ee6 100644 (file)
@@ -137,7 +137,7 @@ krb4_print_hdr(netdissect_options *ndo,
        return (cp);
 
 trunc:
-       ND_PRINT((ndo, tstr));
+       ND_PRINT((ndo, "%s", tstr));
        return (NULL);
 
 #undef PRINT
@@ -159,7 +159,7 @@ krb4_print(netdissect_options *ndo,
        kp = (struct krb *)cp;
 
        if ((&kp->type) >= ndo->ndo_snapend) {
-               ND_PRINT((ndo, tstr));
+               ND_PRINT((ndo, "%s", tstr));
                return;
        }
 
@@ -218,7 +218,7 @@ krb4_print(netdissect_options *ndo,
 
        return;
 trunc:
-       ND_PRINT((ndo, tstr));
+       ND_PRINT((ndo, "%s", tstr));
 }
 
 void
@@ -230,7 +230,7 @@ krb_print(netdissect_options *ndo,
        kp = (struct krb *)dat;
 
        if (dat >= ndo->ndo_snapend) {
-               ND_PRINT((ndo, tstr));
+               ND_PRINT((ndo, "%s", tstr));
                return;
        }
 
index 98334afef8272ef27efedf652138fcc6de1d8e36..8fb42afb89f9e29a3e30af187e0dfb0876ee3e6d 100644 (file)
@@ -995,5 +995,5 @@ ospf6_print(netdissect_options *ndo,
 
        return;
 trunc:
-       ND_PRINT((ndo, tstr));
+       ND_PRINT((ndo, "%s", tstr));
 }
index 6324ea0e1ce30236d819e398354ffa39acdb6491..5f47d4768915fdd56d1771049ba72ca2bfcd130f 100644 (file)
@@ -180,6 +180,6 @@ tftp_print(netdissect_options *ndo,
        }
        return;
 trunc:
-       ND_PRINT((ndo, tstr));
+       ND_PRINT((ndo, "%s", tstr));
        return;
 }
index c0a4f5b5b170d6cbfb4f52f3603bac9e05167371..14ce4450fd2ab73a18d280fb1563c83e98e4ac0e 100644 (file)
@@ -332,7 +332,7 @@ wb_dops(netdissect_options *ndo,
                }
                dh = DOP_NEXT(dh);
                if ((u_char *)dh > ndo->ndo_snapend) {
-                       ND_PRINT((ndo, tstr));
+                       ND_PRINT((ndo, "%s", tstr));
                        break;
                }
        }
@@ -398,7 +398,7 @@ wb_print(netdissect_options *ndo,
 
        ph = (const struct pkt_hdr *)hdr;
        if (len < sizeof(*ph) || (u_char *)(ph + 1) > ndo->ndo_snapend) {
-               ND_PRINT((ndo, tstr));
+               ND_PRINT((ndo, "%s", tstr));
                return;
        }
        len -= sizeof(*ph);