--089e01183de0c4942b04dc5f0605
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
I discovered an issue with the latest version of Nagios from svn with my
company's configuration. When a contactgroup definition contains both
members and contactgroup_members, Nagios segfaults when trying to verify
the configuration. After some debugging, I came up with a solution that
appears to work for us.
The issue is that the when Nagios is "recombobulating" the
contactgroup_members, the call to strchr() is done with a null pointer,
because the loop with the existing controlling expression allows for an
extra iteration. Switching the controlling expression to use next_ptr
allows the loop to exit when it should, because the last iteration's call
to strchr() returns a null pointer. I'm not sure why it doesn't segfault
when specifying either members or contactgroup_members (not both), but my
solution appears to resolve the problem.
Forgive me if there's a different way to propose a patch, as this is my
first post to the list. The (extremely simple) patch is as follows:
---
diff -ur a/xdata/xodtemplate.c b/xdata/xodtemplate.c
--- a/xdata/xodtemplate.c 2013-05-10 09:30:57.000000000 -0600
+++ b/xdata/xodtemplate.c 2013-05-10 09:31:01.000000000 -0600
@@ -6099,7 +6099,7 @@
xodtemplate_contactgroup *cg;
char *ptr, *next_ptr;
- for(next_ptr = ptr = temp_contactgroup->contactgroup_members; ptr; ptr =
next_ptr + 1) {
+ for(next_ptr = ptr = temp_contactgroup->contactgroup_members; next_ptr;
ptr = next_ptr + 1) {
next_ptr = strchr(ptr, ',');
if(next_ptr)
*next_ptr = 0;
---
Cheers,
--
Jeff
--089e01183de0c4942b04dc5f0605
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi all,I discovered an issue with the =
latest version of Nagios from svn with my company's configuration. =A0W=
hen a contactgroup definition contains both members and contactgroup_member=
s, Nagios segfaults when trying to verify the configuration. =A0After some =
debugging, I came up with a solution that appears to work for us.
The issue is that the when Nagios is "recombobulat=
ing" the contactgroup_members, the call to=A0strchr() is done with a n=
ull pointer, because the loop with the existing controlling expression allo=
ws for an extra iteration. =A0Switching the controlling expression to use n=
ext_ptr allows the loop to exit when it should, because the last iteration&=
#39;s call to strchr() returns a null pointer. =A0I'm not sure why it d=
oesn't segfault when specifying either members or contactgroup_members =
(not both), but my solution appears to resolve the problem.
Forgive me if there's a different way to prop=
ose a patch, as this is my first post to the list. =A0The (extremely simple=
) patch is as follows:---
diff -ur a/xdata/xodtemplate.c b/xdata/xodtemplate.c=A0=
--- a/xdata/xodtemplate.c 2013-05-10 09:30:57.000000000 -0600+++ b/xdata/xodte=
mplate.c 2013-05-10 09:31=
:01.000000000 -0600
@@ -6099,7 +6099,7 @@=A0 xodtemplate_contactgroup *cg;=A0 char *ptr, *next_ptr;=A0
- for(next_ptr =3D ptr =
=3D temp_contactgroup->contactgroup_members; ptr; ptr =3D next_ptr + 1) =
{+ for(next_=
ptr =3D ptr =3D temp_contactgroup->contactgroup_members; next_ptr; ptr =
=3D next_ptr + 1) {
=A0 next_ptr =3D =
strchr(ptr, ',');=A0 if(next_ptr)=A0<span class=3D"" style=3D"white=
-space
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]