From 4d0da84ffb272e8f1a435d8a6cc12b852dbc4e28 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 9 May 2022 18:15:17 -0400 Subject: [PATCH] fix: Correct type of strtoimax call --- runtime/include/json.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/include/json.h b/runtime/include/json.h index bcf98a7..fd27124 100644 --- a/runtime/include/json.h +++ b/runtime/include/json.h @@ -142,7 +142,7 @@ static inline int parse_uint32_t(jsmntok_t tok, const char *json_buf, const char *key, uint32_t *ret) { char *end = NULL; - uintmax_t temp = strtoimax(&json_buf[tok.start], &end, 10); + intmax_t temp = strtoimax(&json_buf[tok.start], &end, 10); if (end != &json_buf[tok.end] || temp < 0 || temp > UINT32_MAX) { fprintf(stderr, "Unable to parse uint32_t for key %s\n", key); @@ -157,10 +157,10 @@ static inline int parse_uint64_t(jsmntok_t tok, const char *json_buf, const char *key, uint64_t *ret) { char *end = NULL; - uintmax_t temp = strtoimax(&json_buf[tok.start], &end, 10); + intmax_t temp = strtoimax(&json_buf[tok.start], &end, 10); if (end != &json_buf[tok.end] || temp < 0 || temp > UINT64_MAX) { - fprintf(stderr, "Unable to parse uint32_t for key %s\n", key); + fprintf(stderr, "Unable to parse uint64_t for key %s\n", key); return -1; }