summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2011-08-05 13:59:44 +0200
committerAndre Lorbach <alorbach@adiscon.com>2011-08-05 13:59:44 +0200
commit3229fbeb1e1183141cbf2508334a52f6a082c40b (patch)
tree4e57e2183f92c31f4574d4e80d08e70e21306f25
parentda52cbae520e747568162ad558bf01d40658c745 (diff)
downloadrsyslog-3229fbeb1e1183141cbf2508334a52f6a082c40b.tar.gz
rsyslog-3229fbeb1e1183141cbf2508334a52f6a082c40b.tar.xz
rsyslog-3229fbeb1e1183141cbf2508334a52f6a082c40b.zip
bugfix: potential misadressing in property replacer
-rw-r--r--ChangeLog1
-rw-r--r--runtime/msg.c14
2 files changed, 8 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index b547f0ea..2494a86b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ Version 3.22.4 [v3-stable] (rgerhards), 2010-??-??
offset
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=271
- improved some code based on clang static analyzer results
+- bugfix: potential misadressing in property replacer
---------------------------------------------------------------------------
Version 3.22.3 [v3-stable] (rgerhards), 2010-11-24
- bugfix(important): problem in TLS handling could cause rsyslog to loop
diff --git a/runtime/msg.c b/runtime/msg.c
index 375b9861..22303adb 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -2314,7 +2314,12 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
}
/* check for "." and ".." (note the parenthesis in the if condition!) */
- if((*pRes == '.') && (*(pRes + 1) == '\0' || (*(pRes + 1) == '.' && *(pRes + 2) == '\0'))) {
+ if(*pRes == '\0') {
+ if(*pbMustBeFreed == 1)
+ free(pRes);
+ pRes = "_";
+ *pbMustBeFreed = 0;
+ } else if((*pRes == '.') && (*(pRes + 1) == '\0' || (*(pRes + 1) == '.' && *(pRes + 2) == '\0'))) {
char *pTmp = pRes;
if(*(pRes + 1) == '\0')
@@ -2324,12 +2329,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
if(*pbMustBeFreed == 1)
free(pTmp);
*pbMustBeFreed = 0;
- } else if(*pRes == '\0') {
- if(*pbMustBeFreed == 1)
- free(pRes);
- pRes = "_";
- *pbMustBeFreed = 0;
- }
+ }
}
/* Now drop last LF if present (pls note that this must not be done