[PATCH] xodtemplate: Fix crash when referring to invalid servicegroups

robin.sonefors at op5.com robin.sonefors at op5.com
Thu Nov 29 10:51:25 CET 2012


From: Robin Sonefors <robin.sonefors at op5.com>

The code for printing error messages when a service is referring to an
invalid servicegroup was incorrect, because it used the wrong pointer -
which can be uninitialized - for writing file and line of the error.

In other words: when you do things incorrectly, nagios will no longer do
so too.

Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
---
 xdata/xodtemplate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c
index 34da566..3914abc 100644
--- a/xdata/xodtemplate.c
+++ b/xdata/xodtemplate.c
@@ -6452,7 +6452,7 @@ int xodtemplate_recombobulate_servicegroups(void) {
 		/* 10/19/07 EG an empry return value means an error occured */
 		if((servicegroup_names = xodtemplate_process_servicegroup_names(temp_service->service_groups, temp_service->_config_file, temp_service->_start_line)) == NULL) {
 			logit(NSLOG_CONFIG_ERROR, TRUE, "Error: Failed to process servicegroup names for service '%s' on host '%s' (config file '%s', starting at line %d)\n",
-				  temp_service->service_description, temp_service->host_name, xodtemplate_config_file_name(temp_servicegroup->_config_file), temp_servicegroup->_start_line);
+				  temp_service->service_description, temp_service->host_name, xodtemplate_config_file_name(temp_service->_config_file), temp_service->_start_line);
 			return ERROR;
 			}
 
-- 
1.7.11.7


------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
VERIFY Test and improve your parallel project with help from experts 
and peers. http://goparallel.sourceforge.net




More information about the Developers mailing list