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

Andreas Ericsson ae at op5.se
Thu Nov 29 11:05:59 CET 2012


On 11/29/2012 10:51 AM, robin.sonefors at op5.com wrote:
> 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.
> 

Good catch. Thanks.

> 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;
>   			}
>   
> 


-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
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