Page 1 of 1

[Nagios-devel] Segfault in xdata/xodtemplate.c:13774 + patch

Posted: Mon Feb 12, 2007 11:31 am
by Guest
This is a multi-part message in MIME format.
--------------070605010504000708090405
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hallo,

i'm used the CVS snapshot of today and after converting my nagios.cfg i
got with 'nagios -v /etc/nagios3/nagios.cfg' - Debugger output:

(gdb) bt
#0 0x00002aaaaafcefc0 in strlen () from /lib/libc.so.6
#1 0x00002aaaaafced06 in strdup () from /lib/libc.so.6
#2 0x0000000000480dd7 in xodtemplate_add_member_to_memberlist
(list=0x7fffffa55fc0, name1=0x5f9ce6 "mytest", name2=0xfffffeff00000000
) at ../xdata/xodtemplate.c:13774
#3 0x000000000047ef42 in
xodtemplate_add_hostgroup_members_to_memberlist (list=0x7fffffa55fc0,
temp_hostgroup=0x5b5df0, _config_file=6, _start_line=154) at
../xdata/xodtemplate.c:12684
#4 0x000000000047ea1c in xodtemplate_expand_hostgroups
(list=0x7fffffa55fc0, reject_list=0x7fffffa55fb8, hostgroups=0x5bada0
"nntp-server", _config_file=6, _start_line=154) at
../xdata/xodtemplate.c:12488
#5 0x000000000047e647 in xodtemplate_expand_hostgroups_and_hosts
(hostgroups=0x5bada0 "nntp-server", hosts=0x0, _config_file=6,
_start_line=154) at ../xdata/xodtemplate.c:12325
#6 0x00000000004694d1 in xodtemplate_duplicate_services () at
../xdata/xodtemplate.c:4318
#7 0x000000000045447d in xodtemplate_read_config_data
(main_config_file=0x5af010 "/etc/nagios3/nagios.cfg", options=32511,
cache=0, precache=0) at ../xdata/xodtemplate.c:278
#8 0x000000000044b120 in read_object_config_data
(main_config_file=0x5af010 "/etc/nagios3/nagios.cfg", options=32511,
cache=0, precache=0) at ../common/objects.c:93
#9 0x0000000000419a0a in read_all_object_data
(main_config_file=0x5af010 "/etc/nagios3/nagios.cfg") at config.c:225
#10 0x000000000040f420 in main (argc=3, argv=0x7fffffa56438) at
nagios.c:470
(gdb)

(gdb) frame 2
#2 0x0000000000480dd7 in xodtemplate_add_member_to_memberlist
(list=0x7fffffa55fc0, name1=0x5f9ce6 "mytest", name2=0xfffffeff00000000
) at ../xdata/xodtemplate.c:13774
(gdb)

See the pointer of name2 :
and this is not null. This happens an an amd64 machine. I think the
problem ist the call of xodtemplate_add_member_to_memberlist with only
two parameters: list,member_name. After patching (see attachment), the
error is gone.

Regards
Herbert Straub

--------------070605010504000708090405
Content-Type: text/x-patch;
name="xodtemplate-segfault.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="xodtemplate-segfault.c.patch"

--- xdata/xodtemplate.c.orig 2007-02-12 18:01:31.000000000 +0100
+++ xdata/xodtemplate.c 2007-02-12 18:03:37.000000000 +0100
@@ -12191,7 +12191,7 @@
continue;

/* add contact to list */
- xodtemplate_add_member_to_memberlist(list,temp_contact->contact_name);
+ xodtemplate_add_member_to_memberlist(list,temp_contact->contact_name,NULL);
}

/* free memory allocated to compiled regexp */
@@ -12216,7 +12216,7 @@
continue;

/* add contact to list */
- xodtemplate_add_member_to_memberlist(list,temp_contact->contact_name);
+ xodtemplate_add_member_to_memberlist(list,temp_contact->contact_name,NULL);
}
}

@@ -12236,7 +12236,7 @@
found_match=TRUE;

/* add contact to list */
- xodtemplate_add_member_to_memberlist((reject_item==TRUE)?reject_list:list,temp_ptr,temp_contact->contact_name);
+ xodtemplate_add_member_to_memberlist((reject_item==TRUE)?reject_list:list,temp_ptr,temp_contact->contact_name,NULL);
}
}
}
@@ -12296,7 +12296,7 @@
strip(member_name);

/* add contact to the list */
- xodtemplate_add_member_to_memberlist(list,member_name);
+ xodtemplate_add_member_to_memberlist(list,member_name,NULL);
}

my_free((void **)&group_members);
@@ -12577,7 +12577,7 @@
continue;

/* add host to list */
- xodtemplate_add_member_to_memberlist(list,temp_host->host_name);
+ xodtemplate_add_member_to_memberlist(list,temp_host->host_name,NULL);
}

/* free memory allocated to compiled regexp */
@@ -12602,7 +12602,7 @@
continue;

/* add host to list */
- xodtemplate

...[email truncated]...


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