conf: fatal error if "include" is a mapping

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
pull/8638/head
Jason Ish 2 years ago committed by Victor Julien
parent 67ce33a97e
commit 6e1cd7bbea

@ -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++);

Loading…
Cancel
Save