summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-09 12:25:51 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-09 12:25:51 +0200
commitcafb951020817cca6b89b5cc6b91f3a8ab86f29a (patch)
treee95afa136bad2056c20a63bf9652995669250a1d
parent33c5bb3c08d7f826862ff78816be82cbe09d17eb (diff)
downloadrsyslog-cafb951020817cca6b89b5cc6b91f3a8ab86f29a.tar.gz
rsyslog-cafb951020817cca6b89b5cc6b91f3a8ab86f29a.tar.xz
rsyslog-cafb951020817cca6b89b5cc6b91f3a8ab86f29a.zip
bugfix: message could be truncated after TAG, often when forwarding
This was a result of an internal processing error if maximum field sizes had been specified in the property replacer.
-rw-r--r--ChangeLog5
-rw-r--r--runtime/msg.c2
-rw-r--r--template.c6
3 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index db3e69f7..6e5fec93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------
+Version 5.1.3 [DEVEL] (rgerhards), 2009-07-??
+- bugfix: message could be truncated after TAG, often when forwarding
+ This was a result of an internal processing error if maximum field
+ sizes had been specified in the property replacer.
+---------------------------------------------------------------------------
Version 5.1.2 [DEVEL] (rgerhards), 2009-07-08
- bugfix: properties inputname, fromhost, fromhost-ip, msg were lost when
working with disk queues
diff --git a/runtime/msg.c b/runtime/msg.c
index 63ed0083..4d48c895 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -2405,6 +2405,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
--iLen;
}
*pBuf = '\0';
+ bufLen -= iLen; /* subtract remaining lenght if the string was smaller! */
if(*pbMustBeFreed == 1)
free(pRes);
pRes = pBufStart;
@@ -2858,7 +2859,6 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
bufLen = strlen(pRes);
*pPropLen = bufLen;
- /*dbgprintf("MsgGetProp(\"%s\"): \"%s\"\n", pName, pRes); only for verbose debug logging */
ENDfunc
return(pRes);
}
diff --git a/template.c b/template.c
index 832183b0..0116e782 100644
--- a/template.c
+++ b/template.c
@@ -121,8 +121,10 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *
if(iBuf + iLenVal + 1 >= *pLenBuf) /* we reserve one char for the final \0! */
CHKiRet(ExtendBuf(ppBuf, pLenBuf, iBuf + iLenVal + 1));
- memcpy(*ppBuf + iBuf, pVal, iLenVal);
- iBuf += iLenVal;
+ if(iLenVal > 0) { /* may be zero depending on property */
+ memcpy(*ppBuf + iBuf, pVal, iLenVal);
+ iBuf += iLenVal;
+ }
if(bMustBeFreed)
free(pVal);