!107 回合社区补丁
From: @pengyi37 Reviewed-by: @foreson, @yanan-rock Signed-off-by: @yanan-rock
This commit is contained in:
commit
235206064c
@ -0,0 +1,66 @@
|
||||
From 246b8d8553b6880146d6c489a28cf4bacea8a199 Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Gerhards <rgerhards@adiscon.com>
|
||||
Date: Fri, 30 Dec 2022 17:13:17 +0100
|
||||
Subject: [PATCH] core bugfix: template system may generate invalid json
|
||||
|
||||
When
|
||||
- a list template
|
||||
- is created with option.jsonf="on"
|
||||
- and the last list element is a property with onEmpty="skip"
|
||||
- and that property is actually empty
|
||||
invalid JSON is generated.
|
||||
|
||||
The JSON string in this case ends with ", " instead of "}\n". This
|
||||
patch fixes the issue.
|
||||
|
||||
closes https://github.com/rsyslog/rsyslog/issues/5050
|
||||
---
|
||||
|
||||
Conflict:NA
|
||||
Reference:https://github.com/rsyslog/rsyslog/commit/246b8d8553b6880146d6c489a28cf4bacea8a199
|
||||
---
|
||||
template.c | 16 +++++++++++++---
|
||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/template.c b/template.c
|
||||
index 21d8b8d..18bcda7 100644
|
||||
--- a/template.c
|
||||
+++ b/template.c
|
||||
@@ -163,6 +163,7 @@ tplToString(struct template *__restrict__ const pTpl,
|
||||
unsigned short bMustBeFreed = 0;
|
||||
uchar *pVal;
|
||||
rs_size_t iLenVal = 0;
|
||||
+ int need_comma = 0;
|
||||
|
||||
if(pTpl->pStrgen != NULL) {
|
||||
CHKiRet(pTpl->pStrgen(pMsg, iparam));
|
||||
@@ -230,15 +231,24 @@ tplToString(struct template *__restrict__ const pTpl,
|
||||
if(iBuf + iLenVal + extra_space >= iparam->lenBuf) /* we reserve one char for the final \0! */
|
||||
CHKiRet(ExtendBuf(iparam, iBuf + iLenVal + 1));
|
||||
|
||||
+ if(need_comma) {
|
||||
+ memcpy(iparam->param + iBuf, ", ", 2);
|
||||
+ iBuf += 2;
|
||||
+ }
|
||||
memcpy(iparam->param + iBuf, pVal, iLenVal);
|
||||
iBuf += iLenVal;
|
||||
if(pTpl->optFormatEscape == JSONF) {
|
||||
- memcpy(iparam->param + iBuf,
|
||||
- (pTpe->pNext == NULL) ? "}\n" : ", ", 2);
|
||||
- iBuf += 2;
|
||||
+ need_comma = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+ if((pTpl->optFormatEscape == JSONF) && (pTpe->pNext == NULL)) {
|
||||
+ /* space was reserved while processing field above
|
||||
+ (via extra_space in ExtendBuf() new size formula. */
|
||||
+ memcpy(iparam->param + iBuf, "}\n", 2);
|
||||
+ iBuf += 2;
|
||||
+ }
|
||||
+
|
||||
if(bMustBeFreed) {
|
||||
free(pVal);
|
||||
bMustBeFreed = 0;
|
||||
--
|
||||
2.27.0
|
||||
@ -0,0 +1,47 @@
|
||||
From 1128d320750fb6cfe57b8ad53ef1d5ddf80c81cf Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Gerhards <rgerhards@adiscon.com>
|
||||
Date: Sun, 4 Dec 2022 16:05:22 +0100
|
||||
Subject: [PATCH] omprog bugfix: invalid status handling at called program
|
||||
|
||||
There is a bug when external program *startup* does not return "OK". This
|
||||
can also lead to a misadressing with potentially a segfault (very unlikely).
|
||||
Note that no problem exists once the initializiation phase of the external
|
||||
program is finished and regular message transfer runs.
|
||||
|
||||
The problem basically is that for a startup failure, the control data for
|
||||
that external program instance is freed on error. Unfortunately, that state
|
||||
data is needed later on to detect a suspended instance. We now keep the control
|
||||
data even on init failure (as we then need to do normal control options).
|
||||
|
||||
closes https://github.com/rsyslog/rsyslog/issues/4967
|
||||
---
|
||||
Conflict:NA
|
||||
Reference:https://github.com/rsyslog/rsyslog/commit/1128d320750fb6cfe57b8ad53ef1d5ddf80c81cf
|
||||
---
|
||||
plugins/omprog/omprog.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/plugins/omprog/omprog.c b/plugins/omprog/omprog.c
|
||||
index 4f46f92..dd83e93 100644
|
||||
--- a/plugins/omprog/omprog.c
|
||||
+++ b/plugins/omprog/omprog.c
|
||||
@@ -379,6 +379,7 @@ cleanupChild(instanceData *pData, childProcessCtx_t *pChildCtx)
|
||||
static void
|
||||
terminateChild(instanceData *pData, childProcessCtx_t *pChildCtx)
|
||||
{
|
||||
+ DBGPRINTF("terminateChild called\n");
|
||||
assert(pChildCtx->bIsRunning);
|
||||
|
||||
if (pData->bSignalOnClose) {
|
||||
@@ -927,9 +928,6 @@ CODESTARTcreateWrkrInstance
|
||||
}
|
||||
|
||||
finalize_it:
|
||||
- if(iRet != RS_RET_OK && !pWrkrData->pData->bForceSingleInst) {
|
||||
- free(pWrkrData->pChildCtx);
|
||||
- }
|
||||
ENDcreateWrkrInstance
|
||||
|
||||
|
||||
--
|
||||
2.27.0
|
||||
13
rsyslog.spec
13
rsyslog.spec
@ -7,7 +7,7 @@
|
||||
|
||||
Name: rsyslog
|
||||
Version: 8.2210.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: The rocket-fast system for log processing
|
||||
License: (GPLv3+ and ASL 2.0)
|
||||
URL: http://www.rsyslog.com/
|
||||
@ -32,7 +32,9 @@ Patch9005: print-main-queue-info-to-journal-when-receive-USR1-signal.patch
|
||||
%endif
|
||||
|
||||
Patch6000: backport-core-bugfix-local-hostname-invalid-if-no-global-config-object-given.patch
|
||||
Patch6001: backport-imtcp-bugfix-legacy-config-directives-did-no-longer-work.patch
|
||||
Patch6001: backport-imtcp-bugfix-legacy-config-directives-did-no-longer-work.patch
|
||||
Patch6002: backport-core-bugfix-template-system-may-generate-invalid-json.patch
|
||||
Patch6003: backport-omprog-bugfix-invalid-status-handling-at-called-prog.patch
|
||||
|
||||
BuildRequires: gcc autoconf automake bison dos2unix flex pkgconfig python3-docutils libtool
|
||||
BuildRequires: libgcrypt-devel libuuid-devel zlib-devel krb5-devel libnet-devel gnutls-devel
|
||||
@ -507,6 +509,13 @@ done
|
||||
%{_mandir}/man1/rscryutil.1.gz
|
||||
|
||||
%changelog
|
||||
* Tue Apr 4 2023 pengyi <pengyi37@huawei.com> - 8.2210.0-2
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:omprog bugfix: invalid status handling at called program
|
||||
core bugfix: template system may generate invalid json
|
||||
|
||||
* Sat Feb 4 2023 pengyi <pengyi37@huawei.com> - 8.2210.0-1
|
||||
- Type:NA
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user