summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-04-01 08:30:33 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-04-01 08:30:33 +0200
commit404230c4bdd42e1d9ca673ba3cc128c2b1e936e4 (patch)
treef76bc7b8bf46a93699d618dc2e45edd2e4c13538 /runtime
parentf139dc28feb74f9c8b66736905ae7d3cacd035b6 (diff)
parent302ad02e7781892856c1cacaf98a87f90db9571c (diff)
downloadrsyslog-404230c4bdd42e1d9ca673ba3cc128c2b1e936e4.tar.gz
rsyslog-404230c4bdd42e1d9ca673ba3cc128c2b1e936e4.tar.xz
rsyslog-404230c4bdd42e1d9ca673ba3cc128c2b1e936e4.zip
Merge branch 'v4-stable' into v5-stable
Conflicts: tools/syslogd.c
Diffstat (limited to 'runtime')
-rw-r--r--runtime/msg.c9
-rw-r--r--runtime/parser.c9
2 files changed, 9 insertions, 9 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index af868102..6424b03a 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -2014,6 +2014,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)
@@ -2325,13 +2327,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 38f72986..ca20a11e 100644
--- a/runtime/parser.c
+++ b/runtime/parser.c
@@ -317,7 +317,10 @@ SanitizeMsg(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;
@@ -331,8 +334,9 @@ SanitizeMsg(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
@@ -386,6 +390,7 @@ SanitizeMsg(msg_t *pMsg)
}
++iSrc;
}
+ pDst[iDst] = '\0';
MsgSetRawMsg(pMsg, (char*)pDst, iDst); /* save sanitized string */