From 030e8360702c2c5e227fa70b257f8b3fd048333b Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 24 Jul 2013 09:50:14 +0200 Subject: 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. --- plugins/omelasticsearch/omelasticsearch.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/omelasticsearch/omelasticsearch.c') 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: -- cgit v1.2.3