From 470795e65ba77cffba3aed850313a5f23c4b278d 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 (cherry picked from commit dd71ef0af222a566e54dfc479dd1951dd17d7ceb) --- src/suricata.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/suricata.c b/src/suricata.c index 5c8c7cfafe..70b4dfae86 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -503,7 +503,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; @@ -518,7 +518,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 = SCMalloc(bpf_len); if (unlikely(bpf_filter == NULL)) { -- 2.47.2