[icinga-checkins] icinga.org: icinga-core/next: Truncate plugin output to 2048 bytes.

git at icinga.org git at icinga.org
Tue Oct 30 17:03:29 CET 2012


Module: icinga-core
Branch: next
Commit: 2d7d55cdb4af6b2c535f788993f533c6d3996116
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=2d7d55cdb4af6b2c535f788993f533c6d3996116

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Oct 22 15:37:28 2012 +0200

Truncate plugin output to 2048 bytes.

---

 module/idoutils/src/dbhandlers.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/module/idoutils/src/dbhandlers.c b/module/idoutils/src/dbhandlers.c
index 8788887..0c791f3 100644
--- a/module/idoutils/src/dbhandlers.c
+++ b/module/idoutils/src/dbhandlers.c
@@ -4202,6 +4202,7 @@ int ido2db_handle_hoststatusdata(ido2db_idi *idi) {
 	int x = 0;
 	int result = IDO_OK;
 	void *data[56];
+	const int PLUGIN_OUTPUT_SIZE = 2048; /* table servicestatus column output length */
 
 	ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_handle_hoststatusdata() start\n");
 
@@ -4254,6 +4255,9 @@ int ido2db_handle_hoststatusdata(ido2db_idi *idi) {
 	result = ido2db_convert_string_to_double(idi->buffered_input[IDO_DATA_NORMALCHECKINTERVAL], &normal_check_interval);
 	result = ido2db_convert_string_to_double(idi->buffered_input[IDO_DATA_RETRYCHECKINTERVAL], &retry_check_interval);
 
+	if (strlen(idi->buffered_input[IDO_DATA_OUTPUT]) > PLUGIN_OUTPUT_SIZE)
+		idi->buffered_input[IDO_DATA_OUTPUT][PLUGIN_OUTPUT_SIZE] = '\0';
+
 	es[0] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_OUTPUT]);
 	es[1] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_LONGOUTPUT]);
 	es[2] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_PERFDATA]);
@@ -4417,6 +4421,7 @@ int ido2db_handle_servicestatusdata(ido2db_idi *idi) {
 	int x = 0;
 	int result = IDO_OK;
 	void *data[58];
+	const int PLUGIN_OUTPUT_SIZE = 2048; /* table servicestatus column output length */
 
 	ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_handle_servicestatusdata() start\n");
 
@@ -4470,6 +4475,9 @@ int ido2db_handle_servicestatusdata(ido2db_idi *idi) {
 	result = ido2db_convert_string_to_double(idi->buffered_input[IDO_DATA_NORMALCHECKINTERVAL], &normal_check_interval);
 	result = ido2db_convert_string_to_double(idi->buffered_input[IDO_DATA_RETRYCHECKINTERVAL], &retry_check_interval);
 
+	if (strlen(idi->buffered_input[IDO_DATA_OUTPUT]) > PLUGIN_OUTPUT_SIZE)
+		idi->buffered_input[IDO_DATA_OUTPUT][PLUGIN_OUTPUT_SIZE] = '\0';
+
 	es[0] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_OUTPUT]);
 	es[1] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_LONGOUTPUT]);
 	es[2] = ido2db_db_escape_string(idi, idi->buffered_input[IDO_DATA_PERFDATA]);





More information about the icinga-checkins mailing list