From: Philippe Antoine Date: Mon, 4 Nov 2024 16:09:32 +0000 (+0100) Subject: suricata/bpf: fix -Wshorten-64-to-32 warning X-Git-Tag: suricata-8.0.0-beta1~735 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12088%2Fhead;p=thirdparty%2Fsuricata.git suricata/bpf: fix -Wshorten-64-to-32 warning Ticket: 7366 Ticket: 6186 --- diff --git a/src/suricata.c b/src/suricata.c index 0de8039be1..49505f94ba 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)) {