diff options
author | pluknet <pluknet@FreeBSD.org> | 2013-08-21 16:46:06 +0000 |
---|---|---|
committer | pluknet <pluknet@FreeBSD.org> | 2013-08-21 16:46:06 +0000 |
commit | fd7d22e698e8d06ccf08bc25b2fe2445b4c19137 (patch) | |
tree | e03f15ce6f08604b5c1831786c0bad70612d83bb /lib/libutil | |
parent | 42d76a02b5eebd4a6480e0683cc67fea1d3b16a0 (diff) | |
download | FreeBSD-src-fd7d22e698e8d06ccf08bc25b2fe2445b4c19137.zip FreeBSD-src-fd7d22e698e8d06ccf08bc25b2fe2445b4c19137.tar.gz |
Check strtoumax(3) for ERANGE in case of non-prefixed string.
OK'd by: silence on current@
MFC after: 1 week
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/expand_number.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libutil/expand_number.c b/lib/libutil/expand_number.c index 5d55884..0a62c12 100644 --- a/lib/libutil/expand_number.c +++ b/lib/libutil/expand_number.c @@ -55,6 +55,10 @@ expand_number(const char *buf, uint64_t *num) number = strtoumax(buf, &endptr, 0); + if (number == UINTMAX_MAX && errno == ERANGE) { + return (-1); + } + if (endptr == buf) { /* No valid digits. */ errno = EINVAL; |