|
|
ee3a35 |
From 5bbd0a4b3c212425ace54bf8a8ede5b832776209 Mon Sep 17 00:00:00 2001
|
|
|
ee3a35 |
From: Rainer Gerhards <rgerhards@adiscon.com>
|
|
|
ee3a35 |
Date: Wed, 6 Sep 2017 13:16:42 +0200
|
|
|
ee3a35 |
Subject: [PATCH] core: memory corruption during configuration parsing
|
|
|
ee3a35 |
|
|
|
ee3a35 |
when omfwd is used with the $streamdriverpermittedpeers legacy
|
|
|
ee3a35 |
parameter, a memory corruption can occur. This depends on the
|
|
|
ee3a35 |
length of the provided strings and probably the malloc subsystem.
|
|
|
ee3a35 |
|
|
|
ee3a35 |
Once config parsing succeeds, no problem can happen.
|
|
|
ee3a35 |
|
|
|
ee3a35 |
Thanks to Brent Douglas for initially reporting this issue and
|
|
|
ee3a35 |
providing great analysis.
|
|
|
ee3a35 |
Thanks to github user bwdoll for analyzing this bug and providing
|
|
|
ee3a35 |
a suggested fix (which is almost what this commit includes).
|
|
|
ee3a35 |
|
|
|
ee3a35 |
closes https://github.com/rsyslog/rsyslog/issues/1408
|
|
|
ee3a35 |
closes https://github.com/rsyslog/rsyslog/issues/1474
|
|
|
ee3a35 |
---
|
|
|
ee3a35 |
tools/omfwd.c | 4 ----
|
|
|
ee3a35 |
1 file changed, 4 deletions(-)
|
|
|
ee3a35 |
|
|
|
ee3a35 |
diff --git a/tools/omfwd.c b/tools/omfwd.c
|
|
|
ee3a35 |
index 3bffbb3cc..8d51fbb51 100644
|
|
|
ee3a35 |
--- a/tools/omfwd.c
|
|
|
ee3a35 |
+++ b/tools/omfwd.c
|
|
|
ee3a35 |
@@ -1157,7 +1157,6 @@ CODESTARTnewActInst
|
|
|
ee3a35 |
pData->pszStrmDrvrAuthMode = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
|
|
|
ee3a35 |
} else if(!strcmp(actpblk.descr[i].name, "streamdriverpermittedpeers")) {
|
|
|
ee3a35 |
uchar *start, *str;
|
|
|
ee3a35 |
- uchar save;
|
|
|
ee3a35 |
uchar *p;
|
|
|
ee3a35 |
int lenStr;
|
|
|
ee3a35 |
str = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
|
|
|
ee3a35 |
@@ -1170,8 +1169,6 @@ CODESTARTnewActInst
|
|
|
ee3a35 |
if(*p == ',') {
|
|
|
ee3a35 |
*p = '\0';
|
|
|
ee3a35 |
}
|
|
|
ee3a35 |
- save = *(p+1); /* we always have this, at least the \0 byte at EOS */
|
|
|
ee3a35 |
- *(p+1) = '\0';
|
|
|
ee3a35 |
if(*start == '\0') {
|
|
|
ee3a35 |
DBGPRINTF("omfwd: ignoring empty permitted peer\n");
|
|
|
ee3a35 |
} else {
|
|
|
ee3a35 |
@@ -1181,7 +1178,6 @@ CODESTARTnewActInst
|
|
|
ee3a35 |
start = p+1;
|
|
|
ee3a35 |
if(lenStr)
|
|
|
ee3a35 |
--lenStr;
|
|
|
ee3a35 |
- *(p+1) = save;
|
|
|
ee3a35 |
}
|
|
|
ee3a35 |
free(str);
|
|
|
ee3a35 |
} else if(!strcmp(actpblk.descr[i].name, "ziplevel")) {
|