Module: check_mk
Branch: master
Commit: cff302d3da5f9a6fcfe25f957584e6be0c41d89a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cff302d3da5f9a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 7 17:17:01 2013 +0100
livestatus: FIX: possible crash with VERY long downtime comments
---
ChangeLog | 4 ++++
livestatus/src/module.c | 9 ++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bd4af74..ce91457 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,10 @@
logwatch_ec ruleset. With this option the forwarding can now be enabled
for each logfile on a host
+1.2.2b5:
+ livestatus:
+ * FIX: possible crash with VERY long downtime comments
+
1.2.2b4:
Core:
* FIX: Fix output of cmk -D: datasource programs were missing
diff --git a/livestatus/src/module.c b/livestatus/src/module.c
index 74c0510..f528052 100644
--- a/livestatus/src/module.c
+++ b/livestatus/src/module.c
@@ -480,9 +480,8 @@ void livestatus_log_initial_states()
while (h) {
if (h->scheduled_downtime_depth > 0) {
- sprintf(buffer,"HOST DOWNTIME ALERT: %s;STARTED;%s", h->name,
get_downtime_comment(h->name, NULL));
+ snprintf(buffer, sizeof(buffer), "HOST DOWNTIME ALERT:
%s;STARTED;%s", h->name, get_downtime_comment(h->name, NULL));
write_to_all_logs(buffer, LG_INFO);
-
}
h = h->next;
}
@@ -490,7 +489,7 @@ void livestatus_log_initial_states()
service *s = (service *)service_list;
while (s) {
if (s->scheduled_downtime_depth > 0) {
- sprintf(buffer,"SERVICE DOWNTIME ALERT: %s;%s;STARTED;%s",
s->host_name, s->description,
+ snprintf(buffer, sizeof(buffer), "SERVICE DOWNTIME ALERT:
%s;%s;STARTED;%s", s->host_name, s->description,
get_downtime_comment(s->host_name, s->description));
write_to_all_logs(buffer, LG_INFO);
}
@@ -509,8 +508,8 @@ int broker_event(int event_type __attribute__ ((__unused__)), void
*data)
{
if (g_thread_running == 1 )
livestatus_log_initial_states();
- else if (log_initial_states == 1)
- write_to_all_logs("logging intitial states", LG_INFO);
+ else if (log_initial_states == 1) // initi
+ write_to_all_logs("logging intitial states", LG_INFO); // initial
info during startup
}
update_timeperiods_cache(ts->timestamp.tv_sec);
return 0;