From 6482fcec594d2a5b6c542e1cf0ccbe962a248e55 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 20 Apr 2014 19:06:54 +0200 Subject: [PATCH] Make print_number work for negative numbers again. Refs #4865 --- third-party/cJSON/cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/cJSON/cJSON.c b/third-party/cJSON/cJSON.c index 5ebfcc38a..70ed0014b 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 + (int)log10(d)); /* This is a nice tradeoff. */ + str=(char*)cJSON_malloc(64 + (int)log10(fabs(d))); /* This is a nice tradeoff. */ if (str) { if (d != d) strcpy(str, "0");