mirror of
https://github.com/json-c/json-c.git
synced 2026-03-27 17:09:06 +08:00
Apply same EINVAL handling to json_parse_uint64() as was done for json_parse_int64(). Document that overflow/underflow for these functions is not an error, but sets errno=ERANGE.
This commit is contained in:
@@ -269,7 +269,12 @@ int json_parse_uint64(const char *buf, uint64_t *retval)
|
||||
val = strtoull(buf, &end, 10);
|
||||
if (end != buf)
|
||||
*retval = val;
|
||||
return ((val == 0 && errno != 0) || (end == buf)) ? 1 : 0;
|
||||
if ((val == 0 && errno != 0) || (end == buf))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_REALLOC
|
||||
|
||||
Reference in New Issue
Block a user