fix invalid memory access in parse_string

This commit is contained in:
miaosu 2023-08-09 20:33:03 +08:00
parent cb8693b058
commit 6dd02df262

View File

@ -778,7 +778,7 @@ static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_bu
unsigned char *output = NULL;
/* not a string */
if (buffer_at_offset(input_buffer)[0] != '\"')
if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != '\"')
{
goto fail;
}