Skip to content

Commit 399eb3f

Browse files
DavidKorczynskicharles-lunarg
authored andcommitted
cjson: add NULL check prior to strcmp
This fixes an issue found by OSS-Fuzz: https://issues.oss-fuzz.com/issues/42529964
1 parent b0177a9 commit 399eb3f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

loader/cJSON.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ cJSON *loader_cJSON_GetArrayItem(cJSON *array, int item) {
951951
}
952952
cJSON *loader_cJSON_GetObjectItem(cJSON *object, const char *string) {
953953
cJSON *c = object->child;
954-
while (c && strcmp(c->string, string)) c = c->next;
954+
while (c && NULL != c->string && strcmp(c->string, string)) c = c->next;
955955
return c;
956956
}
957957

0 commit comments

Comments
 (0)