summaryrefslogtreecommitdiffstats
path: root/plugins/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/utils.c')
-rw-r--r--plugins/utils.c10
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 */
231bool is_int64(char *number, int64_t *target) { 231bool 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 }