File 0001-imklog-fix-invalid-memory-adressing-could-cause-abor.patch of Package rsyslog.29819
From 1cc2c66d7d5234ed0aa70155a0755c2f59ca20f1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards <rgerhards@adiscon.com> Date: Tue, 10 Aug 2021 11:11:02 +0200 Subject: [PATCH] imklog: fix invalid memory adressing, could cause abort This is a regeression from commit 94c4a87. It introduced a free() call using an object that was no longer valid (the main pointer to the to-be-freed object) was already freed at time of use. This could cause various issues, including a segfault. Note: this bug was triggerred only during late phase of rsyslog shutdown, so it did not affect regular operation. Special thanks to github user wxiaoguang for analyzing the issue and providing a draft fix proposal, on which this patch builds. see also https://github.com/rsyslog/rsyslog/pull/4629 closes https://github.com/rsyslog/rsyslog/issues/4625 --- plugins/imklog/imklog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c index 6c24b5a2d..78cfc3bae 100644 --- a/plugins/imklog/imklog.c +++ b/plugins/imklog/imklog.c @@ -453,6 +453,7 @@ ENDactivateCnf BEGINfreeCnf CODESTARTfreeCnf + free(pModConf->pszBindRuleset); ENDfreeCnf @@ -475,7 +476,6 @@ CODESTARTmodExit if(pInputName != NULL) prop.Destruct(&pInputName); - free(runModConf->pszBindRuleset); /* release objects we used */ objRelease(glbl, CORE_COMPONENT); objRelease(net, CORE_COMPONENT); -- 2.41.0