From bb92fa40d3c0199ed9ba99c883ce4842fd9e6144 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 20 Apr 2024 13:33:54 +0100 Subject: [PATCH] Do not enter macro state with macros disabled Issue: #290 --- src/ucl_parser.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ucl_parser.c b/src/ucl_parser.c index 04014af..1651877 100644 --- a/src/ucl_parser.c +++ b/src/ucl_parser.c @@ -1372,12 +1372,8 @@ ucl_parse_key (struct ucl_parser *parser, struct ucl_chunk *chunk, p = chunk->pos; - if (*p == '.') { - /* It is macro actually */ - if (!(parser->flags & UCL_PARSER_DISABLE_MACRO)) { - ucl_chunk_skipc (chunk, p); - } - + if (*p == '.' && !(parser->flags & UCL_PARSER_DISABLE_MACRO)) { + ucl_chunk_skipc (chunk, p); parser->prev_state = parser->state; parser->state = UCL_STATE_MACRO_NAME; *end_of_object = false; @@ -1415,7 +1411,7 @@ ucl_parse_key (struct ucl_parser *parser, struct ucl_chunk *chunk, *end_of_object = true; return true; } - else if (*p == '.') { + else if (*p == '.' && !(parser->flags & UCL_PARSER_DISABLE_MACRO)) { ucl_chunk_skipc (chunk, p); parser->prev_state = parser->state; parser->state = UCL_STATE_MACRO_NAME;