diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-09-26 14:56:23 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-09-26 14:56:23 +0200 |
commit | 8323e21705dfafdeef565aaf48251f3f76ae7981 (patch) | |
tree | a25b54242b5eff5fe60a65ed5c231dec32438724 /runtime/msg.c | |
parent | 1f8c579badcc777bb7012675a39d3e13cbaf818e (diff) | |
parent | dfae5feb8c09c285a7af403f07a18254d0a86ad3 (diff) | |
download | rsyslog-8323e21705dfafdeef565aaf48251f3f76ae7981.tar.gz rsyslog-8323e21705dfafdeef565aaf48251f3f76ae7981.tar.bz2 rsyslog-8323e21705dfafdeef565aaf48251f3f76ae7981.zip |
Merge branch 'v7-stable-mmrfc5424addhmac'
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 2bd470a1..991da436 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -4206,10 +4206,14 @@ MsgAddToStructuredData(msg_t *pMsg, uchar *toadd, rs_size_t len) uchar *newptr; rs_size_t newlen; DEFiRet; - newlen = pMsg->lenStrucData + len; + newlen = (pMsg->pszStrucData[0] == '-') ? len : pMsg->lenStrucData + len; CHKmalloc(newptr = (uchar*) realloc(pMsg->pszStrucData, newlen+1)); pMsg->pszStrucData = newptr; - memcpy(pMsg->pszStrucData+pMsg->lenStrucData, toadd, len); + if(pMsg->pszStrucData[0] == '-') { /* empty? */ + memcpy(pMsg->pszStrucData, toadd, len); + } else { + memcpy(pMsg->pszStrucData+pMsg->lenStrucData, toadd, len); + } pMsg->pszStrucData[newlen] = '\0'; pMsg->lenStrucData = newlen; finalize_it: |