From: Vsevolod Stakhov Date: Thu, 30 May 2019 16:23:44 +0000 (+0100) Subject: [Minor] LibUCL: Fix reading at the end of chunk X-Git-Tag: 2.0~842 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff83de0104b73b4ac8350ad056c6c853cfd0cff4;p=thirdparty%2Frspamd.git [Minor] LibUCL: Fix reading at the end of chunk --- diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c index 7313b28a37..b048f426a3 100644 --- a/contrib/libucl/ucl_parser.c +++ b/contrib/libucl/ucl_parser.c @@ -2366,20 +2366,22 @@ ucl_state_machine (struct ucl_parser *parser) p = chunk->pos; - if (*p == '[') { - parser->state = UCL_STATE_VALUE; - ucl_chunk_skipc (chunk, p); - seen_obrace = true; - } - else { - - if (*p == '{') { + if (p < chunk->end) { + if (*p == '[') { + parser->state = UCL_STATE_VALUE; ucl_chunk_skipc (chunk, p); - parser->state = UCL_STATE_KEY_OBRACE; seen_obrace = true; } else { - parser->state = UCL_STATE_KEY; + + if (*p == '{') { + ucl_chunk_skipc (chunk, p); + parser->state = UCL_STATE_KEY_OBRACE; + seen_obrace = true; + } + else { + parser->state = UCL_STATE_KEY; + } } }