]> 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>
Thu, 17 Oct 2024 10:38:58 +0000 (12:38 +0200)
Fix potential dereference of nullptr in case
of unsuccessful allocation of memory for
list node

Bug: #7270
(cherry picked from commit c72404e5546635a6239bdd7302fe945f47ce1927)

src/conf-yaml-loader.c

index 463eb2e5823ccb000c8f4ea88f75885599f4a7a5..2754b15567ea461c47c41dc4b1093bf87d63bfec 100644 (file)
@@ -332,6 +332,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, '_')) {