summaryrefslogtreecommitdiffstats
path: root/plugins/omelasticsearch
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/omelasticsearch')
-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: