diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-11-01 11:05:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 11:05:50 +0100 |
commit | 6d08e1c8c96d0327a5b819dc1fbb0d5754f3e2e5 (patch) | |
tree | 575867b1d1eef4cd20215f22f9151ebb4a02c93d /plugins/utils.c | |
parent | 03bde80abbda6fba2225568c3285a2ff2b5445a8 (diff) | |
parent | 76d9f25cd0dbe99657baeb6fa139a1831558adae (diff) | |
download | monitoring-plugins-6d08e1c.tar.gz |
Merge branch 'master' into fix_check_mailq
Diffstat (limited to 'plugins/utils.c')
-rw-r--r-- | plugins/utils.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index 7e14b6e4..e871c5f7 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -230,13 +230,21 @@ bool is_intnonneg (char *number) { | |||
230 | */ | 230 | */ |
231 | bool is_int64(char *number, int64_t *target) { | 231 | bool is_int64(char *number, int64_t *target) { |
232 | errno = 0; | 232 | errno = 0; |
233 | uint64_t tmp = strtoll(number, NULL, 10); | 233 | char *endptr = { 0 }; |
234 | |||
235 | int64_t tmp = strtoll(number, &endptr, 10); | ||
234 | if (errno != 0) { | 236 | if (errno != 0) { |
235 | return false; | 237 | return false; |
236 | } | 238 | } |
239 | |||
240 | if (*endptr == '\0') { | ||
241 | return 0; | ||
242 | } | ||
243 | |||
237 | if (tmp < INT64_MIN || tmp > INT64_MAX) { | 244 | if (tmp < INT64_MIN || tmp > INT64_MAX) { |
238 | return false; | 245 | return false; |
239 | } | 246 | } |
247 | |||
240 | if (target != NULL) { | 248 | if (target != NULL) { |
241 | *target = tmp; | 249 | *target = tmp; |
242 | } | 250 | } |