Module: check_mk
Branch: master
Commit: 7bf295c0f362566c7c096b91a82b684763ce7673
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7bf295c0f36256…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Jun 29 17:00:11 2015 +0200
#2318 FIX windows agent: no longer crashes when a cached plugin has several hundred
sections
The windows agent crashed when a single cached plugin reported several hundred sections.
Cached plugins needs to be postprocessed, which requires additional heap buffer.
The extra heap buffer was set to a too small value. This has been fixed.
Conflicts:
ChangeLog
agents/windows/check_mk_agent-64.exe
agents/windows/check_mk_agent-64.unversioned.exe
agents/windows/check_mk_agent.exe
agents/windows/check_mk_agent.msi
agents/windows/check_mk_agent.unversioned.exe
agents/windows/install_agent-64.exe
agents/windows/install_agent.exe
---
.werks/2318 | 12 ++++++++++++
ChangeLog | 1 +
agents/windows/check_mk_agent-64.exe | Bin 302080 -> 302080 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 302080 -> 302080 bytes
agents/windows/check_mk_agent.cc | 5 ++++-
agents/windows/check_mk_agent.exe | Bin 183808 -> 183808 bytes
agents/windows/check_mk_agent.msi | Bin 734720 -> 734720 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 183808 -> 183808 bytes
agents/windows/install_agent-64.exe | Bin 179043 -> 179044 bytes
agents/windows/install_agent.exe | Bin 160001 -> 160003 bytes
10 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/2318 b/.werks/2318
new file mode 100644
index 0000000..9f3ae76
--- /dev/null
+++ b/.werks/2318
@@ -0,0 +1,12 @@
+Title: windows agent: no longer crashes when a cached plugin has several hundred
sections
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1435589516
+
+The windows agent crashed when a single cached plugin reported several hundred sections.
+Cached plugins needs to be postprocessed, which requires additional heap buffer.
+The extra heap buffer was set to a too small value. This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index b53fbe5..62e420b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
* 2382 FIX: mssql_backup: Formating age output more human friendly
* 2383 FIX: FreeBSD Agent: Fixed handling <<<ps>>> section when
jailed
* 2368 FIX: ucd_cpu_load: fix exception in case of dump SNMP agent sending 12,540000
instead of 12.540000
+ * 2318 FIX: windows agent: no longer crashes when a cached plugin has several hundred
sections...
Multisite:
* 2314 FIX: Availability: fixed exception when grouping by host or service group
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 9ab768b..666b0f4 100755
Binary files a/agents/windows/check_mk_agent-64.exe and
b/agents/windows/check_mk_agent-64.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index 85549ab..3ca66e0 100755
Binary files a/agents/windows/check_mk_agent-64.unversioned.exe and
b/agents/windows/check_mk_agent-64.unversioned.exe differ
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 9a9653f..1c2cd52 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -3107,8 +3107,11 @@ void output_external_programs(SOCKET &out, script_type type)
// We need to parse each line and replace any
<<<section>>> with
<<<section:cached(123455678,3600)>>>
// Allocate new buffer, process/modify each line of the original
buffer and write it into the new buffer
+ // We increase this new buffer by a good amount, because there might
be several hundred
+ // sections (e.g. veeam_backup status piggyback) within this plugin
output.
+ // TODO: Maybe add a dry run mode. Count the number of section lines
and reserve a fitting extra heap
int buffer_heap_size = HeapSize(GetProcessHeap(), 0,
cont->buffer_work);
- char *cache_buffer = (char*) HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, buffer_heap_size + 1024);
+ char *cache_buffer = (char*) HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, buffer_heap_size + 262144);
int cache_buffer_offset = 0;
char *line = strtok(cont->buffer_work, "\n");
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index ab87943..eedb2d9 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/check_mk_agent.msi b/agents/windows/check_mk_agent.msi
index 971b791..3db52a5 100755
Binary files a/agents/windows/check_mk_agent.msi and b/agents/windows/check_mk_agent.msi
differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index 5bba86d..0573dc3 100755
Binary files a/agents/windows/check_mk_agent.unversioned.exe and
b/agents/windows/check_mk_agent.unversioned.exe differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index 0159fcf..7ef306c 100755
Binary files a/agents/windows/install_agent-64.exe and
b/agents/windows/install_agent-64.exe differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index 4fcb964..1c31b2d 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ