]> granicus.if.org Git - icinga2/commitdiff
Fix parsing performance data labels which contain '='
authorGunnar Beutner <gunnar@beutner.name>
Tue, 13 Oct 2015 07:38:31 +0000 (09:38 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 13 Oct 2015 11:12:42 +0000 (13:12 +0200)
fixes #10254

lib/base/string.hpp
lib/icinga/perfdatavalue.cpp

index d0945be32f202ab50e0f00122e979f6b73deb6fa..5d393f6f9e826f1e77b50b47e43fcc79bf6dcd10 100644 (file)
@@ -192,6 +192,16 @@ public:
                return m_Data.find_first_not_of(ch, pos);
        }
 
+       inline SizeType FindLastOf(const char *s, SizeType pos = NPos) const
+       {
+               return m_Data.find_last_of(s, pos);
+       }
+
+       inline SizeType FindLastOf(char ch, SizeType pos = NPos) const
+       {
+               return m_Data.find_last_of(ch, pos);
+       }
+
        inline String SubStr(SizeType first, SizeType len = NPos) const
        {
                return m_Data.substr(first, len);
index b3e0ae1be6f5e7749047cb5bdbcdcaf0d2dabfac..ae8e27f00abad183820ce385f76860cea0825458 100644 (file)
@@ -50,7 +50,7 @@ PerfdataValue::PerfdataValue(String label, double value, bool counter,
 
 PerfdataValue::Ptr PerfdataValue::Parse(const String& perfdata)
 {
-       size_t eqp = perfdata.FindFirstOf('=');
+       size_t eqp = perfdata.FindLastOf('=');
 
        if (eqp == String::NPos)
                BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid performance data value: " + perfdata));