]> The Tcpdump Group git mirrors - tcpdump/commitdiff
PFLOG: Use nd_printjnp() instead of %s conversion specifier
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 14 Dec 2020 20:18:06 +0000 (21:18 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 14 Dec 2020 20:24:52 +0000 (21:24 +0100)
This change add a bounds checks.

print-pflog.c

index 814c635c16de87e7859bbc829c895a5ce8451a9d..f9e758a01958f22aaaa0cca2d4e1dbb8df210413 100644 (file)
@@ -94,8 +94,11 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr)
        subrulenr = GET_BE_U_4(&hdr->subrulenr);
        if (subrulenr == (uint32_t)-1)
                ND_PRINT("rule %u/", rulenr);
-       else
-               ND_PRINT("rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr);
+       else {
+               ND_PRINT("rule %u.", rulenr);
+               nd_printjnp(ndo, hdr->ruleset, PFLOG_RULESET_NAME_SIZE);
+               ND_PRINT(".%u/", subrulenr);
+       }
 
        ND_PRINT("%s: %s %s on %s: ",
            tok2str(pf_reasons, "unkn(%u)", GET_U_1(&hdr->reason)),