From b9c6abc38c27fe971acc2e59c03bde2220bf4094 Mon Sep 17 00:00:00 2001 From: Michael Insel Date: Fri, 20 Nov 2020 17:13:19 +0100 Subject: [PATCH] Fix perfdata parser not recognize scientific notation The scientific notation is basically allowed in our performance data parser. In an edge case where scientific notation is delivered with an upercas E letter our parser does not recognize it and drops it as false performance data. The wrong interpretation as false performance data affects all parts of the performance data, the value itself, the warning value, the critical value, the minimum value and the maximum value. --- lib/base/perfdatavalue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/base/perfdatavalue.cpp b/lib/base/perfdatavalue.cpp index 422988d80..5531dc418 100644 --- a/lib/base/perfdatavalue.cpp +++ b/lib/base/perfdatavalue.cpp @@ -45,7 +45,7 @@ PerfdataValue::Ptr PerfdataValue::Parse(const String& perfdata) String valueStr = perfdata.SubStr(eqp + 1, spq - eqp - 1); - size_t pos = valueStr.FindFirstNotOf("+-0123456789.e"); + size_t pos = valueStr.FindFirstNotOf("+-0123456789.eE"); double value = Convert::ToDouble(valueStr.SubStr(0, pos)); @@ -160,7 +160,7 @@ String PerfdataValue::Format() const Value PerfdataValue::ParseWarnCritMinMaxToken(const std::vector& tokens, std::vector::size_type index, const String& description) { - if (tokens.size() > index && tokens[index] != "U" && tokens[index] != "" && tokens[index].FindFirstNotOf("+-0123456789.e") == String::NPos) + if (tokens.size() > index && tokens[index] != "U" && tokens[index] != "" && tokens[index].FindFirstNotOf("+-0123456789.eE") == String::NPos) return Convert::ToDouble(tokens[index]); else { if (tokens.size() > index && tokens[index] != "")