]> granicus.if.org Git - icinga2/commitdiff
Use String::ToString() in CompatComponent::ProcessCommand().
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 21 Jan 2013 12:45:27 +0000 (13:45 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 21 Jan 2013 12:45:27 +0000 (13:45 +0100)
components/compat/compatcomponent.cpp

index cad4442b59d3d4ad93d3f0f8169b008c2125b0eb..5f933866ce829bc92002706f0cc496af9859b240 100644 (file)
@@ -155,7 +155,14 @@ void CompatComponent::ProcessCommand(const String& command)
        String timestamp = command.SubStr(1, pos - 1);
        String args = command.SubStr(pos + 2, String::NPos);
 
-       double ts = strtod(timestamp.CStr(), NULL);
+       double ts = timestamp.ToDouble();
+
+       if (ts == 0) {
+               Logger::Write(LogWarning, "compat", "Invalid timestamp in command: " + command);
+
+               return;
+       }
+
        vector<String> argv = args.Split(is_any_of(";"));
 
        if (argv.size() == 0) {