aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-06-01 14:56:23 +0000
committerMark Johnston <markj@FreeBSD.org>2021-06-08 13:37:48 +0000
commit1adf2f76c0c89db1beb2de4ac03a0b70db84bb6a (patch)
treecb24ccacbdbf1d8e4341f67b153a717e739b5239
parent39917ef2a85fa92a641bd6be346068f6097c8e98 (diff)
downloadsrc-1adf2f76c0c89db1beb2de4ac03a0b70db84bb6a.tar.gz
src-1adf2f76c0c89db1beb2de4ac03a0b70db84bb6a.zip
pf: Avoid leaking pad bytes in struct pfr_astats when copying out
There is padding between pfr_astats.pfras_a and pfras_packets that was not getting initialized. Reported by: KMSAN Reviewed by: kp, imp Sponsored by: The FreeBSD Foundation (cherry picked from commit 60a38abb8982e11ee71559057dd7128bd097043e)
-rw-r--r--sys/netpfil/pf/pf_table.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c
index 58b453cd550c..e9fd5f133c3f 100644
--- a/sys/netpfil/pf/pf_table.c
+++ b/sys/netpfil/pf/pf_table.c
@@ -1029,6 +1029,7 @@ pfr_copyout_astats(struct pfr_astats *as, const struct pfr_kentry *ke,
int dir, op;
const struct pfr_kcounters *kc = &ke->pfrke_counters;
+ bzero(as, sizeof(*as));
pfr_copyout_addr(&as->pfras_a, ke);
as->pfras_tzero = kc->pfrkc_tzero;