diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-11-25 18:04:00 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-11-25 18:04:00 +0100 |
commit | 786a44a0243cc6a5b0d47fb15f8f20a1a3f5bf0e (patch) | |
tree | 1948874c8d8b7a876ad5e3817a292889b94a68d4 /template.c | |
parent | 950fe206f84322bdff755988403a9d4017ec26f4 (diff) | |
parent | 44300ddcb2904105e2ecd56479bf396399dcab26 (diff) | |
download | rsyslog-786a44a0243cc6a5b0d47fb15f8f20a1a3f5bf0e.tar.gz rsyslog-786a44a0243cc6a5b0d47fb15f8f20a1a3f5bf0e.tar.bz2 rsyslog-786a44a0243cc6a5b0d47fb15f8f20a1a3f5bf0e.zip |
Merge branch 'v5-devel'
Conflicts:
runtime/rsyslog.h
Diffstat (limited to 'template.c')
-rw-r--r-- | template.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -85,7 +85,7 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t * { DEFiRet; struct templateEntry *pTpe; - int iBuf; + size_t iBuf; unsigned short bMustBeFreed; uchar *pVal; size_t iLenVal; @@ -141,7 +141,15 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t * pTpe = pTpe->pNext; } - (*ppBuf)[iBuf] = '\0'; /* space was reserved above (see copy) */ + if(iBuf == *pLenBuf) { + /* in the weired case of an *empty* template, this can happen. + * it is debatable if we should really fix it here or simply + * forbid that case. However, performance toll is minimal, so + * I tend to permit it. -- 201011-05 rgerhards + */ + CHKiRet(ExtendBuf(ppBuf, pLenBuf, iBuf + 1)); + } + (*ppBuf)[iBuf] = '\0'; finalize_it: RETiRet; |