diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-22 17:16:14 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-22 17:16:14 +0000 |
commit | f7758913542fff6447e9641fbfa5c50fb81effab (patch) | |
tree | d21c5482da09861e22d6231ba532ea341a04fcb3 /contrib/libucl/ucl_parser.c | |
parent | 488e9934253ff342bb4df4e01cea151ac6d2d3d0 (diff) | |
download | rspamd-f7758913542fff6447e9641fbfa5c50fb81effab.tar.gz rspamd-f7758913542fff6447e9641fbfa5c50fb81effab.zip |
Update from the recent libucl
Diffstat (limited to 'contrib/libucl/ucl_parser.c')
-rw-r--r-- | contrib/libucl/ucl_parser.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c index ac3fe0543..7a935a5c7 100644 --- a/contrib/libucl/ucl_parser.c +++ b/contrib/libucl/ucl_parser.c @@ -2298,7 +2298,7 @@ ucl_state_machine (struct ucl_parser *parser) ucl_chunk_skipc (chunk, p); } else { - if (p - c > 0) { + if (c != NULL && p - c > 0) { /* We got macro name */ macro_len = (size_t) (p - c); HASH_FIND (hh, parser->macroes, c, macro_len, macro); @@ -2351,7 +2351,7 @@ ucl_state_machine (struct ucl_parser *parser) macro_start, macro_len); parser->state = parser->prev_state; - if (macro_escaped == NULL) { + if (macro_escaped == NULL && macro != NULL) { if (macro->is_context) { ret = macro->h.context_handler (macro_start, macro_len, macro_args, @@ -2363,7 +2363,7 @@ ucl_state_machine (struct ucl_parser *parser) macro->ud); } } - else { + else if (macro != NULL) { if (macro->is_context) { ret = macro->h.context_handler (macro_escaped, macro_len, macro_args, @@ -2377,15 +2377,22 @@ ucl_state_machine (struct ucl_parser *parser) UCL_FREE (macro_len + 1, macro_escaped); } + else { + ret = false; + ucl_set_err (parser, UCL_EINTERNAL, + "internal error: parser has macro undefined", &parser->err); + } /* * Chunk can be modified within macro handler */ chunk = parser->chunks; p = chunk->pos; + if (macro_args) { ucl_object_unref (macro_args); } + if (!ret) { return false; } |