diff --git a/third-party/cJSON/cJSON.c b/third-party/cJSON/cJSON.c index 75a1527a6..5ebfcc38a 100644 --- a/third-party/cJSON/cJSON.c +++ b/third-party/cJSON/cJSON.c @@ -127,7 +127,7 @@ static char *print_number(cJSON *item) } else { - str=(char*)cJSON_malloc(64); /* This is a nice tradeoff. */ + str=(char*)cJSON_malloc(64 + (int)log10(d)); /* This is a nice tradeoff. */ if (str) { if (d != d) strcpy(str, "0");