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:
parent
0dedcb3154
commit
1e5506588d
1 changed files with 5 additions and 0 deletions
|
@ -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 '\\':
|
||||||
|
|
Loading…
Reference in a new issue