]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use fn_printn() to print strings.
authorGuy Harris <[email protected]>
Sat, 14 Jan 2017 10:02:03 +0000 (02:02 -0800)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 18 Jan 2017 08:16:42 +0000 (09:16 +0100)
Don't just use %.*s - that's not robust in the presence of non-printable
characters in the string.

print-dhcp6.c

index 1e249347fde500c90525a32f4517f2e12f5e61fa..16f82542013f11d3858a3b006ba44cdc011c120d 100644 (file)
@@ -731,7 +731,7 @@ dhcp6opt_print(netdissect_options *ndo,
                        while (remain_len && *tp) {
                                label_len =  *tp++;
                                if (label_len < remain_len - 1) {
-                                       ND_PRINT((ndo, "%.*s", label_len, tp));
+                                       fn_printn(ndo, tp, label_len, NULL);
                                        tp += label_len;
                                        remain_len -= (label_len + 1);
                                        if(*tp) ND_PRINT((ndo, "."));