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>
master
Jouni Malinen 5 years ago
parent 79fa1b4530
commit 0dedcb3154

@ -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;

Loading…
Cancel
Save