]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
yaml: Add check of allocation for node object
authorAlexey Simakov <bigalex934@gmail.com>
Mon, 23 Sep 2024 18:24:48 +0000 (21:24 +0300)
committerVictor Julien <victor@inliniac.net>
Wed, 2 Oct 2024 08:28:24 +0000 (10:28 +0200)
Fix potential dereference of nullptr in case
of unsuccessful allocation of memory for
list node

Bug: #7270

src/conf-yaml-loader.c

index f8b9ae21232a7bf5e20d2e631d03dd2337fcb56c..f70a5f04e88edae051db301bd2457c6f251f9bae 100644 (file)
@@ -330,6 +330,9 @@ static int ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq, int
                             node = existing;
                         } else {
                             node = ConfNodeNew();
+                            if (unlikely(node == NULL)) {
+                                goto fail;
+                            }
                             node->name = SCStrdup(value);
                             node->parent = parent;
                             if (node->name && strchr(node->name, '_')) {