diff --git a/src/util/json_parser.c b/src/util/json_parser.c index 724c99a353..e635fbfef1 100644 --- a/src/util/json_parser.c +++ b/src/util/json_parser.c @@ -278,9 +278,18 @@ static int __parse_json_number(const char *cursor, const char **end, if (*p == '-') p++; + if (!isdigit(*p)) + return -2; + if (*p == '0' && (isdigit(p[1]) || p[1] == 'X' || p[1] == 'x')) return -2; + while (isdigit(*++p)) + ; + + if (*p == '.' && !isdigit(*(p + 1))) + return -2; + *num = strtod(cursor, (char **)end); if (*end == cursor) return -2;