]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
log-pcap: error out if malloc fails for bpf filter
authorJason Ish <jason.ish@oisf.net>
Tue, 8 Apr 2025 21:29:03 +0000 (15:29 -0600)
committerVictor Julien <vjulien@oisf.net>
Wed, 9 Apr 2025 07:34:04 +0000 (09:34 +0200)
src/log-pcap.c

index d8cc305634a9eabd7a6f234e81c99d2d30ff8bfa..0a3ca5e8458ecdd8d044bc3c9d4d47eeff498c89 100644 (file)
@@ -409,6 +409,9 @@ static int PcapLogOpenHandles(PcapLogData *pl, const Packet *p)
                         pcap_geterr(pl->pcap_dead_handle));
             } else {
                 pl->bpfp = SCCalloc(1, sizeof(*pl->bpfp));
+                if (pl->bpfp == NULL) {
+                    FatalError("Failed to allocate memory for BPF filter, aborting");
+                }
                 *pl->bpfp = bpfp;
             }
         }