From e2d64bb2fea18f62a93e936bf3ee295105a09121 Mon Sep 17 00:00:00 2001 From: fincs Date: Thu, 3 May 2018 01:15:43 +0200 Subject: [PATCH] strtoul -> strtoull (don't assume LP64 for Windows) --- src/elf2kip.c | 4 ++-- src/npdmtool.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/elf2kip.c b/src/elf2kip.c index 397a228..4836433 100644 --- a/src/elf2kip.c +++ b/src/elf2kip.c @@ -131,7 +131,7 @@ int cJSON_GetU64(const cJSON *obj, const char *field, u64 *out) { const cJSON *config = cJSON_GetObjectItemCaseSensitive(obj, field); if (cJSON_IsString(config) && (config->valuestring != NULL)) { char *endptr = NULL; - *out = strtoul(config->valuestring, &endptr, 16); + *out = strtoull(config->valuestring, &endptr, 16); if (config->valuestring == endptr) { fprintf(stderr, "Failed to get %s (empty string)\n", field); return 0; @@ -156,7 +156,7 @@ int cJSON_GetU64(const cJSON *obj, const char *field, u64 *out) { int cJSON_GetU64FromObjectValue(const cJSON *config, u64 *out) { if (cJSON_IsString(config) && (config->valuestring != NULL)) { char *endptr = NULL; - *out = strtoul(config->valuestring, &endptr, 16); + *out = strtoull(config->valuestring, &endptr, 16); if (config->valuestring == endptr) { fprintf(stderr, "Failed to get %s (empty string)\n", config->string); return 0; diff --git a/src/npdmtool.c b/src/npdmtool.c index 009fb4a..9b2061f 100644 --- a/src/npdmtool.c +++ b/src/npdmtool.c @@ -184,7 +184,7 @@ int cJSON_GetU64(const cJSON *obj, const char *field, u64 *out) { const cJSON *config = cJSON_GetObjectItemCaseSensitive(obj, field); if (cJSON_IsString(config) && (config->valuestring != NULL)) { char *endptr = NULL; - *out = strtoul(config->valuestring, &endptr, 16); + *out = strtoull(config->valuestring, &endptr, 16); if (config->valuestring == endptr) { fprintf(stderr, "Failed to get %s (empty string)\n", field); return 0; @@ -209,7 +209,7 @@ int cJSON_GetU64(const cJSON *obj, const char *field, u64 *out) { int cJSON_GetU64FromObjectValue(const cJSON *config, u64 *out) { if (cJSON_IsString(config) && (config->valuestring != NULL)) { char *endptr = NULL; - *out = strtoul(config->valuestring, &endptr, 16); + *out = strtoull(config->valuestring, &endptr, 16); if (config->valuestring == endptr) { fprintf(stderr, "Failed to get %s (empty string)\n", config->string); return 0;