1
0
mirror of https://github.com/DaveGamble/cJSON synced 2025-04-28 14:17:56 +00:00

fix fail to catch last backslash # 780

This commit is contained in:
李晓林 2023-09-01 16:33:14 +08:00
parent cb8693b058
commit 12c05dafac

View File

@ -792,7 +792,7 @@ static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_bu
/* is escape sequence */
if (input_end[0] == '\\')
{
if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length)
if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length - 1)
{
/* prevent buffer overflow when last input character is a backslash */
goto fail;