]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ICMP: Avoid printing non-ASCII characters in Interface Name
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Feb 2022 17:57:12 +0000 (18:57 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Feb 2022 18:02:48 +0000 (19:02 +0100)
The "%.*s" format is a risk (no non-ASCII filtering), thus use
the nd_printjnp() function.

print-icmp.c

index 74f327fc251f690cc3a6b414150daabdfca005b2..124fc05d418862d299ecadefe587900a9d8237d8 100644 (file)
@@ -866,9 +866,9 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                             offset += inft_name_length_field;
                             break;
                         }
-                        ND_PRINT(", length %u", inft_name_length_field);
-                        ND_PRINT(": %.*s", inft_name_length_field - 1,
-                                 ifname_subobj->if_name);
+                        ND_PRINT(", length %u", inft_name_length_field);
+                        nd_printjnp(ndo, ifname_subobj->if_name,
+                                    inft_name_length_field - 1);
                         offset += inft_name_length_field;
                     }
                     if (mtu_flag) {