Skip to content

Commit

Permalink
suricata/bpf: fix -Wshorten-64-to-32 warning
Browse files Browse the repository at this point in the history
Ticket: 7366
Ticket: 6186
  • Loading branch information
catenacyber authored and victorjulien committed Nov 5, 2024
1 parent b1c26dc commit dd71ef0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/suricata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)) {
Expand Down

0 comments on commit dd71ef0

Please sign in to comment.