Fix buffer overflow in print_number().

Refs #4865
This commit is contained in:
Gunnar Beutner 2014-04-20 18:30:24 +02:00
parent 466cac1f52
commit 08cdb3676d
1 changed files with 1 additions and 1 deletions

View File

@ -127,7 +127,7 @@ static char *print_number(cJSON *item)
} }
else 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 (str)
{ {
if (d != d) strcpy(str, "0"); if (d != d) strcpy(str, "0");