summaryrefslogtreecommitdiff
path: root/bpf.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-05-12 09:09:26 +0200
committerTobias Klauser <tklauser@distanz.ch>2014-05-12 09:12:08 +0200
commitf2154ee8285abee46028afff19e6bf2cb4794efc (patch)
treeadf381482dc3682c8fa5b7ee8764ad5b71307826 /bpf.c
parent9a40de458b3884d9f526172110392501f075bd87 (diff)
bpf: Zero out socket filter in bpf_parse_rules()
Instead of memsetting the struct sock_filter every time before we call bpf_parse_rules(), do it there directly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'bpf.c')
-rw-r--r--bpf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bpf.c b/bpf.c
index c287597..6239af9 100644
--- a/bpf.c
+++ b/bpf.c
@@ -720,6 +720,8 @@ void bpf_parse_rules(char *rulefile, struct sock_fprog *bpf, uint32_t link_type)
struct sock_filter sf_single = { 0x06, 0, 0, 0xFFFFFFFF };
FILE *fp;
+ fmemset(bpf, 0, sizeof(*bpf));
+
if (rulefile == NULL) {
bpf->len = 1;
bpf->filter = xmalloc(sizeof(sf_single));