reset errno before calling strtoimax.

pull/99/head
Yasuhiro Matsumoto 7 years ago
parent d74f6b2b1a
commit 2e1b6ec996
No known key found for this signature in database
GPG Key ID: 622DE34DC490584B
  1. 4
      parson.c

@ -784,7 +784,9 @@ static JSON_Value * parse_number_value(const char **string) {
char *end; char *end;
double number = 0; double number = 0;
#ifdef JSON_FIXED_NUMBER #ifdef JSON_FIXED_NUMBER
intmax_t fixed = strtoimax(*string, &end, 10); intmax_t fixed;
errno = 0;
fixed = strtoimax(*string, &end, 10);
if (errno == 0 && INT64_MIN <= fixed && fixed <= INT64_MAX) { if (errno == 0 && INT64_MIN <= fixed && fixed <= INT64_MAX) {
*string = end; *string = end;
return json_value_init_fixed(fixed); return json_value_init_fixed(fixed);

Loading…
Cancel
Save