From dd71ef0af222a566e54dfc479dd1951dd17d7ceb Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Mon, 4 Nov 2024 17:09:32 +0100 Subject: [PATCH] suricata/bpf: fix -Wshorten-64-to-32 warning Ticket: 7366 Ticket: 6186 --- src/suricata.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/suricata.c b/src/suricata.c index 0de8039be1f0..49505f94ba89 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -505,7 +505,7 @@ static void SetBpfStringFromFile(char *filename) char *bpf_filter = NULL; char *bpf_comment_tmp = NULL; char *bpf_comment_start = NULL; - uint32_t bpf_len = 0; + size_t bpf_len = 0; SCStat st; FILE *fp = NULL; size_t nm = 0; @@ -520,7 +520,8 @@ static void SetBpfStringFromFile(char *filename) SCLogError("Failed to stat file %s", filename); exit(EXIT_FAILURE); } - bpf_len = st.st_size + 1; + // st.st_size is signed on Windows + bpf_len = ((size_t)(st.st_size)) + 1; bpf_filter = SCCalloc(1, bpf_len); if (unlikely(bpf_filter == NULL)) {