Module: check_mk
Branch: master
Commit: 068cd0820e0f722b706d12b57daca4abb62f21ff
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=068cd0820e0f72…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Fri Jan 26 10:13:36 2018 +0100
5699 FIX Windows agent crashed at non-existent Skype perf counter
Werk #5410 fixed a number of problems related to section Skype. It also
enabled the agent to run further than it was earlier capable of and
revealed some other old problems, this crash, among others. The extent
of the problem is not exactly known but it is likely that the crash was
restricted to some Windows versions only, at least Windows Server 2012
R2 was having the crash under certain circumstances.
---
.werks/5699 | 16 ++++++++++++++++
agents/windows/PerfCounterCommon.h | 5 +++++
agents/windows/build_version | 2 +-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/.werks/5699 b/.werks/5699
new file mode 100644
index 0000000..e044683
--- /dev/null
+++ b/.werks/5699
@@ -0,0 +1,16 @@
+Title: Windows agent crashed at non-existent Skype perf counter
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i3
+Date: 1516959650
+
+Werk #5410 fixed a number of problems related to section Skype. It also
+enabled the agent to run further than it was earlier capable of and
+revealed some other old problems, this crash, among others. The extent
+of the problem is not exactly known but it is likely that the crash was
+restricted to some Windows versions only, at least Windows Server 2012
+R2 was having the crash under certain circumstances.
diff --git a/agents/windows/PerfCounterCommon.h b/agents/windows/PerfCounterCommon.h
index be497ed..2da70e2 100644
--- a/agents/windows/PerfCounterCommon.h
+++ b/agents/windows/PerfCounterCommon.h
@@ -42,8 +42,13 @@ size_t string_length<wchar_t>(const wchar_t *s);
// retrieve the next line from a multi-sz registry key
template <typename CharT>
const CharT *get_next_multi_sz(const std::vector<CharT> &data, size_t &offset) {
+ if (data.size() < offset + 1) {
+ return nullptr;
+ }
+
const CharT *next = &data[offset];
size_t len = string_length(next);
+
if ((len == 0) || (offset + (len * sizeof(CharT)) > data.size())) {
// the second condition would only happen with an invalid registry value
// but that's not unheard of
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 311e81e..6585a1d 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-3080
+3082