[icinga-checkins] icinga.org: icinga2/master: Use String::ToString() in CompatComponent:: ProcessCommand().

git at icinga.org git at icinga.org
Mon Jan 21 13:45:41 CET 2013


Module: icinga2
Branch: master
Commit: ccbb98e64a2d762eb9ba1904b861ec48b917eb2d
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=ccbb98e64a2d762eb9ba1904b861ec48b917eb2d

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Jan 21 13:45:27 2013 +0100

Use String::ToString() in CompatComponent::ProcessCommand().

---

 components/compat/compatcomponent.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/components/compat/compatcomponent.cpp b/components/compat/compatcomponent.cpp
index cad4442..5f93386 100644
--- a/components/compat/compatcomponent.cpp
+++ b/components/compat/compatcomponent.cpp
@@ -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) {





More information about the icinga-checkins mailing list