JSON: Fix string parsing when \\ escape is at the end of buffer

This would have resulted in reading one octet past the end of the buffer
before rejecting the string.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-02-10 01:40:36 +02:00
parent 0dedcb3154
commit 1e5506588d

View File

@ -103,6 +103,11 @@ static char * json_parse_string(const char **json_pos, const char *end)
return str; return str;
case '\\': case '\\':
pos++; pos++;
if (pos >= end) {
wpa_printf(MSG_DEBUG,
"JSON: Truncated \\ escape");
goto fail;
}
switch (*pos) { switch (*pos) {
case '"': case '"':
case '\\': case '\\':