summaryrefslogtreecommitdiff
path: root/print-pflog.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-12-14 21:18:06 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-12-14 21:24:52 +0100
commit833305f9288d19f46158cb7932d32fad176f3e28 (patch)
treeccec03bc2dca26073cc1afd8b817d26b56512228 /print-pflog.c
parent607c27486bfb79df22ee5f2e72787a1551ef9ea6 (diff)
downloadtcpdump-833305f9288d19f46158cb7932d32fad176f3e28.tar.gz
PFLOG: Use nd_printjnp() instead of %s conversion specifier
This change add a bounds checks.
Diffstat (limited to 'print-pflog.c')
-rw-r--r--print-pflog.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/print-pflog.c b/print-pflog.c
index 814c635c..f9e758a0 100644
--- a/print-pflog.c
+++ b/print-pflog.c
@@ -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)),