From: Jouni Malinen Date: Sat, 9 Feb 2019 23:33:42 +0000 (+0200) Subject: JSON: Fix parsing of a number from the end of the buffer X-Git-Tag: hostap_2_8~388 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dedcb3154fad12c1ee48bb4102dfea2c11de6d9;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/utils/json.c b/src/utils/json.c index b9130d3a6..c6ada0548 100644 --- a/src/utils/json.c +++ b/src/utils/json.c @@ -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;