[icinga-checkins] icinga.org: icinga2/feature/ido: Fix nullptr deref in Service:: GetLastCheckPerfData().

git at icinga.org git at icinga.org
Thu Jul 11 09:03:51 CEST 2013


Module: icinga2
Branch: feature/ido
Commit: 664916dffb0307d3e6a709fd636fbedbe3f8b409
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=664916dffb0307d3e6a709fd636fbedbe3f8b409

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Jul 10 09:57:18 2013 +0200

Fix nullptr deref in Service::GetLastCheckPerfData().

---

 lib/icinga/service-check.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp
index f6ea309..57e805b 100644
--- a/lib/icinga/service-check.cpp
+++ b/lib/icinga/service-check.cpp
@@ -301,9 +301,13 @@ String Service::GetLastCheckLongOutput(void) const
 String Service::GetLastCheckPerfData(void) const
 {
 	Dictionary::Ptr cr = GetLastCheckResult();
-	String perfdata = cr->Get("performance_data_raw");
+	String perfdata;
 
-	boost::algorithm::replace_all(perfdata, "\n", "\\n");
+	if (cr) {
+		perfdata = cr->Get("performance_data_raw");
+
+		boost::algorithm::replace_all(perfdata, "\n", "\\n");
+	}
 
 	return perfdata;
 }





More information about the icinga-checkins mailing list