Fix heap buffer overflow

Fixes #800
This commit is contained in:
orri 2024-04-30 09:50:19 +00:00 committed by Alan Wang
parent 826cd6f842
commit 3ef4e4e730
1 changed files with 5 additions and 0 deletions

View File

@ -1660,6 +1660,11 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu
current_item = new_item;
}
if (cannot_access_at_index(input_buffer, 1))
{
goto fail; /* nothing comes after the comma */
}
/* parse the name of the child */
input_buffer->offset++;
buffer_skip_whitespace(input_buffer);