diff --git a/cJSON.c b/cJSON.c index d0aad03..6ded617 100644 --- a/cJSON.c +++ b/cJSON.c @@ -88,6 +88,11 @@ static char* cJSON_strdup(const char* str) size_t len = 0; char *copy = NULL; + if (str == NULL) + { + return NULL; + } + len = strlen(str) + 1; if (!(copy = (char*)cJSON_malloc(len))) {