]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
datasets: fix error handling in StringSet
authorEric Leblond <el@stamus-networks.com>
Mon, 9 Jun 2025 08:04:35 +0000 (10:04 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 11 Jun 2025 18:49:18 +0000 (20:49 +0200)
src/datasets-string.c

index d237406f2be19327a9028c9f73c8f9a391e32a4f..f5f4cc89c97988fabd705e649ea02d56aff1492e 100644 (file)
@@ -65,7 +65,10 @@ int StringSet(void *dst, void *src)
 
     dst_s->len = src_s->len;
     dst_s->ptr = SCMalloc(dst_s->len);
-    BUG_ON(dst_s->ptr == NULL);
+    if (dst_s->ptr == NULL) {
+        SCLogError("Failed to allocate memory for string of length %u", dst_s->len);
+        return -1;
+    }
     memcpy(dst_s->ptr, src_s->ptr, dst_s->len);
 
     dst_s->rep = src_s->rep;