Module: check_mk
Branch: master
Commit: bbcd81eb28ec3dcab8100ae7efac504698247d7d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bbcd81eb28ec3d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jul 23 16:43:59 2013 +0200
windows agent: some fixes with possible script buffer overflows
---
agents/windows/check_mk_agent-64.exe | Bin 178688 -> 178688 bytes
agents/windows/check_mk_agent.cc | 9 ++++++---
agents/windows/check_mk_agent.exe | Bin 151040 -> 151040 bytes
agents/windows/install_agent-64.exe | Bin 148906 -> 148888 bytes
agents/windows/install_agent.exe | Bin 146421 -> 146432 bytes
5 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index e8a9f86..33cc7da 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.cc b/agents/windows/check_mk_agent.cc
index d419e02..efeeaf6 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -103,11 +103,11 @@
// Maximum heap buffer for a single local/plugin script
// This buffer contains the check output
-#define SCRIPT_BUFFER_HEAP 65536
+#define SCRIPT_BUFFER_HEAP 524288
// Maximum timeout for a single local/plugin script
#define DEFAULT_PLUGIN_TIMEOUT 60
-#define DEFAULT_LOCAL_TIMEOUT 60
+#define DEFAULT_LOCAL_TIMEOUT 60
// Check compilation environment 32/64 bit
#if _WIN32 || _WIN64
@@ -2289,6 +2289,9 @@ int launch_program(script_container* cont)
}
}
+ if (out_offset >= SCRIPT_BUFFER_HEAP)
+ break;
+
if (exit != STILL_ACTIVE)
break;
@@ -2309,7 +2312,7 @@ int launch_program(script_container* cont)
DWORD WINAPI ScriptWorkerThread(LPVOID lpParam)
{
script_container* cont = (script_container*) lpParam;
- cont->buffer_work = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
SCRIPT_BUFFER_HEAP);
+ cont->buffer_work = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
SCRIPT_BUFFER_HEAP + 1);
// Execute script
int result = launch_program(cont);
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index ee73ef2..f8a42ac 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index 34093dd..802e583 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 6865768..6623c5b 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ