소스 검색

check_users segmentation fault if both thresholds are not provided

Fix for issue #254
John C. Frickson 9 년 전
부모
커밋
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;