From 56f2bc6f3e65e15f0b3ca50f59a2104fd30d8e99 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Tue, 27 Jun 2017 22:58:25 +0200 Subject: [PATCH] handle null pointers: cJSON_PrintPreallocated --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 16acd42..80d35db 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1122,7 +1122,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const i { printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; - if (len < 0) + if ((len < 0) || (buf == NULL)) { return false; }