Kaynağa Gözat

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@tcen.ru> for reporting this in Debian bug #623702.
Sebastian Harl 15 yıl önce
ebeveyn
işleme
5ebe25fc24
3 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 1 0
      NEWS
  2. 1 0
      THANKS.in
  3. 1 1
      plugins-root/check_icmp.c

+ 1 - 0
NEWS

@@ -14,6 +14,7 @@ This file documents the major additions and syntax changes between releases.
 	Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds
 	Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds
 	Fix check_ldap overriding the port when --ssl was specified after -p
 	Fix check_ldap overriding the port when --ssl was specified after -p
 	Fix check_procs where regex input of '|' would get displayed in output - now replaced with ','
 	Fix check_procs where regex input of '|' would get displayed in output - now replaced with ','
+	Fix segfault in check_host when hostname returns multiple IP addresses (Sebastian Harl)
 
 
 1.4.15 27th July 2010
 1.4.15 27th July 2010
 	ENHANCEMENTS
 	ENHANCEMENTS

+ 1 - 0
THANKS.in

@@ -268,3 +268,4 @@ Brian Landers
 Ryan Kelly
 Ryan Kelly
 Stéphane Urbanovski
 Stéphane Urbanovski
 Marco Beck
 Marco Beck
+Sebastian Harl

+ 1 - 1
plugins-root/check_icmp.c

@@ -621,7 +621,7 @@ main(int argc, char **argv)
 	}
 	}
 
 
 	host = list;
 	host = list;
-	table = malloc(sizeof(struct rta_host **) * (argc - 1));
+	table = malloc(sizeof(struct rta_host **) * targets);
 	i = 0;
 	i = 0;
 	while(host) {
 	while(host) {
 		host->id = i*packets;
 		host->id = i*packets;