summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-31 01:47:26 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-31 01:47:26 +0100
commitcff821257bebdbfba87d183726ea9672625c2e77 (patch)
tree70cb6d273af0fa999d73f797812bb06efc0e5697 /plugins
parent77e38ac1c025b8431d1834a2c1059f9677c78ab1 (diff)
downloadmonitoring-plugins-cff821257bebdbfba87d183726ea9672625c2e77.tar.gz
check_users: Change option for sanity checking arguments to avoid segfault
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_users.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/check_users.c b/plugins/check_users.c
index 7cf7a2cc..916a691d 100644
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
@@ -227,18 +227,23 @@ process_arguments (int argc, char **argv)
227 } 227 }
228 228
229 c = optind; 229 c = optind;
230
230 if (warning_range == NULL && argc > c) 231 if (warning_range == NULL && argc > c)
231 warning_range = argv[c++]; 232 warning_range = argv[c++];
233
232 if (critical_range == NULL && argc > c) 234 if (critical_range == NULL && argc > c)
233 critical_range = argv[c++]; 235 critical_range = argv[c++];
234 236
235 /* this will abort in case of invalid ranges */ 237 /* this will abort in case of invalid ranges */
236 set_thresholds (&thlds, warning_range, critical_range); 238 set_thresholds (&thlds, warning_range, critical_range);
237 239
238 if (thlds->warning->end < 0) 240 if (!thlds->warning) {
239 usage4 (_("Warning threshold must be a positive integer")); 241 usage4 (_("Warning threshold must be a valid range expression"));
240 if (thlds->critical->end < 0) 242 }
241 usage4 (_("Critical threshold must be a positive integer")); 243
244 if (!thlds->critical) {
245 usage4 (_("Critical threshold must be a valid range expression"));
246 }
242 247
243 return OK; 248 return OK;
244} 249}