Просмотр исходного кода

check_users segmentation fault if both thresholds are not provided

Fix for issue #254
John C. Frickson 9 лет назад
Родитель
Сommit
7ce940c8cd
2 измененных файлов с 4 добавлено и 2 удалено
  1. 2 0
      NEWS
  2. 2 2
      plugins/check_users.c

+ 2 - 0
NEWS

@@ -13,6 +13,8 @@ x.x.x xxxx-xx-xx
 	check_mailq: Fix for Postfix and better Sudo Checking
 	configure.ac: Fix spelling error
 	check_ntp_peer: requires newline when there is a socket timeout (fix in netutils.c)
+	check_users: segmentation fault if both thresholds are not provided
+
 
 2.2.0 2017-01-19
 	ENHANCEMENTS

+ 2 - 2
plugins/check_users.c

@@ -222,9 +222,9 @@ process_arguments (int argc, char **argv)
 	/* this will abort in case of invalid ranges */
 	set_thresholds (&thlds, warning_range, critical_range);
 
-	if (thlds->warning->end < 0)
+	if (!thlds->warning || thlds->warning->end < 0)
 		usage4 (_("Warning threshold must be zero or greater"));
-	if (thlds->critical->end < 0)
+	if (!thlds->critical || thlds->critical->end < 0)
 		usage4 (_("Critical threshold must be zero or greater"));
 
 	return OK;