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 860e4a6
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 (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);
Expand Down

0 comments on commit 860e4a6

Please sign in to comment.