handle null pointers: cJSON_PrintPreallocated

This commit is contained in:
Max Bruckner 2017-06-27 22:58:25 +02:00
parent cdc35ebf88
commit 56f2bc6f3e

View File

@ -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 } }; printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
if (len < 0) if ((len < 0) || (buf == NULL))
{ {
return false; return false;
} }