fixed segfault when the lib tries to parse HTML with embedded CSS; provided test case

This commit is contained in:
Christian Schulze
2016-03-06 16:43:53 +01:00
parent e70366a65a
commit 52d7d14f6c
3 changed files with 37 additions and 2 deletions

View File

@ -660,8 +660,8 @@ static char *print_object(cJSON *item,int depth,int fmt,printbuffer *p)
/* Get Array size/item / object item. */
int cJSON_GetArraySize(cJSON *array) {cJSON *c=array->child;int i=0;while(c)i++,c=c->next;return i;}
cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array->child; while (c && item>0) item--,c=c->next; return c;}
cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;}
cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c; if (array == NULL) return NULL; c=array->child; while (c && item>0) item--,c=c->next; return c;}
cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c; if (object == NULL) return NULL; c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;}
int cJSON_HasObjectItem(cJSON *object,const char *string) {
cJSON *c=object->child;
while (c )