JSON: Fix parsing of a number from the end of the buffer

Avoid reading one octet past the end of the buffer when parsing a number
that is at the very end of the buffer.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-02-10 01:33:42 +02:00
parent 79fa1b4530
commit 0dedcb3154

View file

@ -165,6 +165,8 @@ static int json_parse_number(const char **json_pos, const char *end,
break;
}
}
if (pos == end)
pos--;
if (pos < *json_pos)
return -1;
len = pos - *json_pos + 1;