From 0051f23e1241863897486bcab8f379580bf70d22 Mon Sep 17 00:00:00 2001 From: cpq Date: Sun, 21 Mar 2021 16:14:44 +0000 Subject: [PATCH] Even stricted check in mg_to64() --- mongoose.c | 2 +- src/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 99a6d017..d4dc69d7 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4212,7 +4212,7 @@ int mg_asprintf(char **buf, size_t size, const char *fmt, ...) { } int64_t mg_to64(struct mg_str str) { - int64_t result = 0, neg = 1, max = 922337203685477580 /* INT64_MAX / 10 */; + int64_t result = 0, neg = 1, max = 922337203685477570 /* INT64_MAX/10-10 */; size_t i = 0; while (i < str.len && (str.ptr[i] == ' ' || str.ptr[i] == '\t')) i++; if (i < str.len && str.ptr[i] == '-') neg = -1, i++; diff --git a/src/util.c b/src/util.c index d4f6c258..61c9e087 100644 --- a/src/util.c +++ b/src/util.c @@ -262,7 +262,7 @@ int mg_asprintf(char **buf, size_t size, const char *fmt, ...) { } int64_t mg_to64(struct mg_str str) { - int64_t result = 0, neg = 1, max = 922337203685477580 /* INT64_MAX / 10 */; + int64_t result = 0, neg = 1, max = 922337203685477570 /* INT64_MAX/10-10 */; size_t i = 0; while (i < str.len && (str.ptr[i] == ' ' || str.ptr[i] == '\t')) i++; if (i < str.len && str.ptr[i] == '-') neg = -1, i++;