@@ -167,6 +167,11 @@ static const unsigned char *parse_number(cJSON *item, const unsigned char *num)
double number = 0;
unsigned char *endpointer = NULL;
+ if (num == NULL)
+ {
+ return NULL;
+ }
+
number = strtod((const char*)num, (char**)&endpointer);
if ((num == endpointer) || (num == NULL))
{
@@ -277,7 +277,7 @@ static cJSON *cJSONUtils_PatchDetach(cJSON *object, const unsigned char *path)
static int cJSONUtils_Compare(cJSON *a, cJSON *b)
- if ((a->type & 0xFF) != (b->type & 0xFF))
+ if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)))
/* mismatched type. */
return -1;