summaryrefslogtreecommitdiffstats
path: root/plugins/omelasticsearch/omelasticsearch.c
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2013-07-24 09:50:14 +0200
committerAndre Lorbach <alorbach@adiscon.com>2013-07-24 09:50:14 +0200
commit030e8360702c2c5e227fa70b257f8b3fd048333b (patch)
treedfab40a0b7047d7971cdf7ae015e6ff06a51d80b /plugins/omelasticsearch/omelasticsearch.c
parentaad5d4099885b127e13c63be9c80608bb460edc7 (diff)
downloadrsyslog-030e8360702c2c5e227fa70b257f8b3fd048333b.tar.gz
rsyslog-030e8360702c2c5e227fa70b257f8b3fd048333b.tar.bz2
rsyslog-030e8360702c2c5e227fa70b257f8b3fd048333b.zip
Fixed a bug in curlPost related to http://bugzilla.adiscon.com/show_bug.cgi?id=464
A Check was added for replylen before writting the 0 Byte to the end of reply data.
Diffstat (limited to 'plugins/omelasticsearch/omelasticsearch.c')
-rw-r--r--plugins/omelasticsearch/omelasticsearch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c
index 5c53ba19..b98a7828 100644
--- a/plugins/omelasticsearch/omelasticsearch.c
+++ b/plugins/omelasticsearch/omelasticsearch.c
@@ -613,8 +613,11 @@ curlPost(instanceData *pData, uchar *message, int msglen, uchar **tpls)
break;
}
- pData->reply[pData->replyLen] = '\0'; /* byte has been reserved in malloc */
- DBGPRINTF("omelasticsearch: es reply: '%s'\n", pData->reply);
+ DBGPRINTF("omelasticsearch: pData replyLen = '%d'\n", pData->replyLen);
+ if (pData->replyLen > 0) {
+ pData->reply[pData->replyLen] = '\0'; /* Append 0 Byte if replyLen is above 0 - byte has been reserved in malloc */
+ }
+ DBGPRINTF("omelasticsearch: pData reply: '%s'\n", pData->reply);
CHKiRet(checkResult(pData, message));
finalize_it: