From 0dedcb3154fad12c1ee48bb4102dfea2c11de6d9 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 10 Feb 2019 01:33:42 +0200 Subject: [PATCH] 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 --- src/utils/json.c | 2 ++ 1 file changed, 2 insertions(+) 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;