Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2020-04-20 21:41:46 +0300
committerVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2020-04-20 21:41:46 +0300
commit5091165d69976217cd73a34c081e77c13187672d (patch)
tree6e73631679ac2a11a0059f700531a0cdf0ae2daa /src/libs/zbxembed/zabbix.c
parent580c08d5bf7eba21aa80e1ad286845c7357c4fe7 (diff)
........S. [ZBXNEXT-5877] limit log size
Diffstat (limited to 'src/libs/zbxembed/zabbix.c')
-rw-r--r--src/libs/zbxembed/zabbix.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libs/zbxembed/zabbix.c b/src/libs/zbxembed/zabbix.c
index 354067af475..147f7a0d340 100644
--- a/src/libs/zbxembed/zabbix.c
+++ b/src/libs/zbxembed/zabbix.c
@@ -25,6 +25,8 @@
#include "duktape.h"
#include "zabbix.h"
+#define ZBX_ES_LOG_MEMORY_LIMIT (ZBX_MEBIBYTE * 8)
+
/******************************************************************************
* *
* Function: es_zabbix_dtor *
@@ -88,6 +90,12 @@ static duk_ret_t es_zabbix_log(duk_context *ctx)
zbx_json_addstring(env->json, "message", message, ZBX_JSON_TYPE_STRING);
zbx_json_close(env->json);
+ if (ZBX_ES_LOG_MEMORY_LIMIT < env->json->buffer_size) /* approximate limit */
+ {
+ return duk_error(ctx, DUK_RET_TYPE_ERROR, "log exceeds the maximum size " ZBX_FS_UI64 " bytes.",
+ ZBX_MAX_RECV_DATA_SIZE);
+ }
+
return 0;
}