[PATCH] net/netfilter: use memset avoid infoleaks
From: cgel . zte
Date: Tue Mar 01 2022 - 03:18:38 EST
From: Minghao Chi (CGEL ZTE) <chi.minghao@xxxxxxxxxx>
Use memset to initialize structs to preventing infoleaks
in __bpf_mt_check_bytecode
Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@xxxxxxxxxx>
---
net/netfilter/xt_bpf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/netfilter/xt_bpf.c b/net/netfilter/xt_bpf.c
index 849ac552a154..5750a68a2a3f 100644
--- a/net/netfilter/xt_bpf.c
+++ b/net/netfilter/xt_bpf.c
@@ -29,6 +29,7 @@ static int __bpf_mt_check_bytecode(struct sock_filter *insns, __u16 len,
if (len > XT_BPF_MAX_NUM_INSTR)
return -EINVAL;
+ memset(&program, 0x0, sizeof(program));
program.len = len;
program.filter = insns;
--
2.25.1