From 2ad2b1c94cc7bb88b879fb0895a3bee566fdf053 Mon Sep 17 00:00:00 2001 From: Emeric Brun Date: Wed, 1 Dec 2021 12:08:42 +0100 Subject: [PATCH] BUG/MAJOR: segfault using multiple log forward sections. For each new log forward section, the proxy was added to the log forward proxy list but the ref on the previous log forward section's proxy was scratched using "init_new_proxy" which performs a memset. After configuration parsing this list contains only the last section's proxy. The post processing walk through this list to resolve "ring" names. Since some section's proxies are missing in this list, the resolving is not done for those ones and the pointer on the ring is kept to null causing a segfault at runtime trying to write a log message into the ring. This patch shift the "init_new_proxy" before adding the ref on the previous log forward section's proxy on currently parsed one. This patch shoud fix github issue #1464 This patch should be backported to 2.3 --- src/log.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index ecf771221..92eef6ebe 100644 --- a/src/log.c +++ b/src/log.c @@ -3738,10 +3738,9 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm) goto out; } + init_new_proxy(px); px->next = cfg_log_forward; cfg_log_forward = px; - - init_new_proxy(px); px->conf.file = strdup(file); px->conf.line = linenum; px->mode = PR_MODE_SYSLOG;