[PATCH] core: Initialize notification macro before access

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[PATCH] core: Initialize notification macro before access

Post by Guest »

--MP_/46TLYwNofx6AQ7iRzJR5st+
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I was about to report this issue but it looks like someone beat me to
it. However unless I'm mistaken the call to clear_volatile_macros() is
redundant anyway, so an updated patch is attached.

Cheers,

--
Adam James, Transitiv Technologies Ltd.

Business Critical Support and Services for Open Source Software.

T: 0203 384 7207
E: [email protected]
W: http://www.transitiv.co.uk/

--MP_/46TLYwNofx6AQ7iRzJR5st+
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=0001-core-Initialize-notification-macro-before-access.patch

From 6882f89244c829561c677d45cbe55e818e0f40e5 Mon Sep 17 00:00:00 2001
From: Adam James
Date: Mon, 18 Jul 2011 19:36:18 +0100
Subject: [PATCH] core: Initialize notification macro before access

This patch fixes a bug created as a result of the patch to move away
from the use of global macros when sending notifications (r1744).

The nagios_macros struct was defined but never initialised and then
passed to clear_volatile_macros(), resulting in a segfault due to an
attempt to free a pointer with a garbage value.

The fix means that the call to clear_volatile_macros() is now redundant
so it has been removed.
---
base/notifications.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/base/notifications.c b/base/notifications.c
index f053f27..a6e56b3 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -1037,9 +1037,6 @@ int host_notification(host *hst, int type, char *not_author, char *not_data, int
return OK;
}

- /* clear volatile macros */
- clear_volatile_macros_r(&mac);
-
log_debug_info(DEBUGL_NOTIFICATIONS,0,"Notification viability test passed.\n");

/* should the notification number be increased? */
@@ -1057,6 +1054,7 @@ int host_notification(host *hst, int type, char *not_author, char *not_data, int
log_debug_info(DEBUGL_NOTIFICATIONS,2,"Creating list of contacts to be notified.\n");

/* create the contact notification list for this host */
+ memset(&mac, 0, sizeof(mac));
create_notification_list_from_host(&mac, hst,options,&escalated);

#ifdef USE_EVENT_BROKER
--
1.7.3.4


--MP_/46TLYwNofx6AQ7iRzJR5st+--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked