aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-03 11:29:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-03 11:29:34 +0000
commit7dec4387d73370389f322e422cb590262b4c9dea (patch)
treefb64900f5038f035d5f0328080ba072d30fd221e /src
parent558382ccc00f08e38d6fd6052636fdb4a852b2bb (diff)
downloadrspamd-7dec4387d73370389f322e422cb590262b4c9dea.tar.gz
rspamd-7dec4387d73370389f322e422cb590262b4c9dea.zip
Fix parsing nested braces inside logger vars
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index b6b44036e..7551e64ef 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -421,6 +421,7 @@ rspamd_config_parse_log_format (struct rspamd_config *cfg)
parse_var_name,
parse_var_content,
} state = parse_str;
+ gint braces = 0;
g_assert (cfg != NULL);
c = cfg->log_format_str;
@@ -478,6 +479,7 @@ rspamd_config_parse_log_format (struct rspamd_config *cfg)
p ++;
c = p;
state = parse_var_content;
+ braces = 1;
}
else if (*p != '_' && *p != '-' && !g_ascii_isalnum (*p)) {
/* Variable with no content */
@@ -496,7 +498,7 @@ rspamd_config_parse_log_format (struct rspamd_config *cfg)
}
break;
case parse_var_content:
- if (*p == '}') {
+ if (*p == '}' && --braces == 0) {
var_content.begin = c;
var_content.len = p - c;
p ++;
@@ -508,6 +510,10 @@ rspamd_config_parse_log_format (struct rspamd_config *cfg)
state = parse_str;
}
+ else if (*p == '{') {
+ braces ++;
+ p ++;
+ }
else {
p++;
}