diff --git a/cJSON.c b/cJSON.c index 4f5b38dc..f1fd0b67 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1660,6 +1660,11 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu current_item = new_item; } + if (input_buffer->offset+1 >= input_buffer->length) + { + goto fail; /* nothing comes after the comma */ + } + /* parse the name of the child */ input_buffer->offset++; buffer_skip_whitespace(input_buffer);