[nagiosplug] check_host: Allocate a large-enough buffer for ...
Thomas Guyot-Sionnest
dermoth at users.sourceforge.net
Fri Apr 29 02:52:33 CEST 2011
Module: nagiosplug
Branch: maint-1.4.15
Commit: 1374f80872412b64bd13f17e6edd70aa59437012
Author: Sebastian Harl <sh at teamix.net>
Committer: Thomas Guyot-Sionnest <dermoth at aei.ca>
Date: Thu Apr 28 09:18:21 2011 +0200
URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=1374f80
check_host: Allocate a large-enough buffer for the host table.
When specifying a host-name on the command line, each of its IPs is added to
the host table (and each one is pinged). So, the buffer has to be large enough
to hold all of the respective host objects. (argc - 1) only fits hosts with a
single IP.
Thanks to Max Kosmach <max at tcen.ru> for reporting this in Debian bug #623702.
---
NEWS | 1 +
THANKS.in | 1 +
plugins-root/check_icmp.c | 2 +-
3 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/NEWS b/NEWS
index e3e8f37..793ac8a 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ This file documents the major additions and syntax changes between releases.
FIXES
Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds.
+ Fix segfault in check_host when hostname returns multiple IP addresses (Sebastian Harl)
1.4.15 27th July 2010
ENHANCEMENTS
diff --git a/THANKS.in b/THANKS.in
index 6666de4..a2c8201 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -265,3 +265,4 @@ Dann Frazier
Stephane Chazelas
Craig Leres
Brian Landers
+Sebastian Harl
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 6d8ba09..fe8fc56 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -621,7 +621,7 @@ main(int argc, char **argv)
}
host = list;
- table = malloc(sizeof(struct rta_host **) * (argc - 1));
+ table = malloc(sizeof(struct rta_host **) * targets);
i = 0;
while(host) {
host->id = i*packets;
More information about the Commits
mailing list