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:
parent
79fa1b4530
commit
0dedcb3154
1 changed files with 2 additions and 0 deletions
|
@ -165,6 +165,8 @@ static int json_parse_number(const char **json_pos, const char *end,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (pos == end)
|
||||||
|
pos--;
|
||||||
if (pos < *json_pos)
|
if (pos < *json_pos)
|
||||||
return -1;
|
return -1;
|
||||||
len = pos - *json_pos + 1;
|
len = pos - *json_pos + 1;
|
||||||
|
|
Loading…
Reference in a new issue