Skip to content

Commit

Permalink
Fix heap buffer overflow
Browse files Browse the repository at this point in the history
Fixes #800
  • Loading branch information
sbvoxel committed May 6, 2024
1 parent 2add3ab commit c390438
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c390438

Please sign in to comment.