diff options
author | Michael Biebl <biebl@debian.org> | 2010-07-07 15:37:41 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2010-07-07 15:37:41 +0200 |
commit | 037725d8367a90e38f4a8f3946920e978abac77f (patch) | |
tree | 4474e17efae0512901843014afb37c26e8c82682 /runtime | |
parent | 0c3924200ff23e6444058f01b2b7446cde6e1581 (diff) | |
download | rsyslog-037725d8367a90e38f4a8f3946920e978abac77f.tar.gz |
Imported Upstream version 4.6.3upstream/4.6.3
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 9 | ||||
-rw-r--r-- | runtime/parser.c | 9 | ||||
-rw-r--r-- | runtime/ruleset.c | 1 |
3 files changed, 10 insertions, 9 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 2ce7843..91057f9 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2010,6 +2010,8 @@ finalize_it: /* set raw message in message object. Size of message is provided. + * The function makes sure that the stored rawmsg is properly + * terminated by '\0'. * rgerhards, 2009-06-16 */ void MsgSetRawMsg(msg_t *pThis, char* pszRawMsg, size_t lenMsg) @@ -2319,13 +2321,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, *pPropLen = sizeof("**INVALID PROPERTY NAME**") - 1; return UCHAR_CONSTANT("**INVALID PROPERTY NAME**"); } - /* the following line fixes the symptom, but not the root cause -- at least MSG sometimes - * returns a size of one too less. To prevent all troubles, we recalculate the sizes based - * on what we actually got. TODO: remove once root cause is found. - * rgerhards, 2010-03-23 - */ - bufLen = ustrlen(pRes); - /* If we did not receive a template pointer, we are already done... */ if(pTpe == NULL) { diff --git a/runtime/parser.c b/runtime/parser.c index 466066e..36e88eb 100644 --- a/runtime/parser.c +++ b/runtime/parser.c @@ -176,7 +176,10 @@ sanitizeMessage(msg_t *pMsg) pszMsg = pMsg->pszRawMsg; lenMsg = pMsg->iLenRawMsg; - /* remove NUL character at end of message (see comment in function header) */ + /* remove NUL character at end of message (see comment in function header) + * Note that we do not need to add a NUL character in this case, because it + * is already present ;) + */ if(pszMsg[lenMsg-1] == '\0') { DBGPRINTF("dropped NUL at very end of message\n"); bUpdatedLen = TRUE; @@ -190,8 +193,9 @@ sanitizeMessage(msg_t *pMsg) */ if(bDropTrailingLF && pszMsg[lenMsg-1] == '\n') { DBGPRINTF("dropped LF at very end of message (DropTrailingLF is set)\n"); - bUpdatedLen = TRUE; lenMsg--; + pszMsg[lenMsg] = '\0'; + bUpdatedLen = TRUE; } /* it is much quicker to sweep over the message and see if it actually @@ -245,6 +249,7 @@ sanitizeMessage(msg_t *pMsg) } ++iSrc; } + pDst[iDst] = '\0'; MsgSetRawMsg(pMsg, (char*)pDst, iDst); /* save sanitized string */ diff --git a/runtime/ruleset.c b/runtime/ruleset.c index d98b421..af61f24 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -348,6 +348,7 @@ destructAllActions(void) CHKiRet(llDestroy(&llRulesets)); CHKiRet(llInit(&llRulesets, rulesetDestructForLinkedList, keyDestruct, strcasecmp)); + pDfltRuleset = NULL; finalize_it: RETiRet; |