]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
JSON: Fix parsing of a number from the end of the buffer
authorJouni Malinen <j@w1.fi>
Sat, 9 Feb 2019 23:33:42 +0000 (01:33 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 11 Feb 2019 00:35:29 +0000 (02:35 +0200)
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>
src/utils/json.c

index b9130d3a65ab048b9f6ae3b60f1f48dade7d5dbd..c6ada05480874dd07368f30524131f0c05a0c868 100644 (file)
@@ -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;