Skip to content

Commit

Permalink
suricata/bpf: fix -Wshorten-64-to-32 warnings
Browse files Browse the repository at this point in the history
Ticket: OISF#6186
  • Loading branch information
catenacyber committed Jul 17, 2024
1 parent c87bccb commit 576f87a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/suricata.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ static void SetBpfStringFromFile(char *filename)
SCLogError("Failed to stat file %s", filename);
exit(EXIT_FAILURE);
}
bpf_len = st.st_size + 1;
if ((uint64_t)st.st_size > UINT32_MAX - 1) {
SCLogError("Too big file %s", filename);
exit(EXIT_FAILURE);
}
bpf_len = (uint32_t)(st.st_size + 1);

bpf_filter = SCCalloc(1, bpf_len);
if (unlikely(bpf_filter == NULL)) {
Expand Down

0 comments on commit 576f87a

Please sign in to comment.