]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
conf: fatal error if "include" is a mapping
authorJason Ish <jason.ish@oisf.net>
Fri, 24 Mar 2023 05:49:55 +0000 (23:49 -0600)
committerVictor Julien <vjulien@oisf.net>
Tue, 28 Mar 2023 11:58:53 +0000 (13:58 +0200)
If a field named "include" is mapping it is not processed correctly.
Instead return a fatal error.

In our YAML, "include" has always been a reserved word, so this should
not break any known configuration.

Ticket: #5939

src/conf-yaml-loader.c

index bbc3c9f8891e8ebd33caa5a841ac72c60cb12590..57b793aa69a5d2caad99f099418f6ef3c2c8a0ff 100644 (file)
@@ -379,6 +379,11 @@ static int ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq, int
         }
         else if (event.type == YAML_MAPPING_START_EVENT) {
             SCLogDebug("event.type=YAML_MAPPING_START_EVENT; state=%d", state);
+            if (state == CONF_INCLUDE) {
+                SCLogError("Include fields cannot be a mapping: line %zu", parser->mark.line);
+                retval = -1;
+                goto fail;
+            }
             if (inseq) {
                 char sequence_node_name[DEFAULT_NAME_LEN];
                 snprintf(sequence_node_name, DEFAULT_NAME_LEN, "%d", seq_idx++);