aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil/expand_number.c
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@FreeBSD.org>2013-08-21 16:46:06 +0000
committerSergey Kandaurov <pluknet@FreeBSD.org>2013-08-21 16:46:06 +0000
commit869f276295d78e0f18c88c2966194a4e5594af3e (patch)
treee03f15ce6f08604b5c1831786c0bad70612d83bb /lib/libutil/expand_number.c
parent28a288cbaa687f19e706dca1e35e0cd5cb23302d (diff)
downloadsrc-869f276295d78e0f18c88c2966194a4e5594af3e.tar.gz
src-869f276295d78e0f18c88c2966194a4e5594af3e.zip
Check strtoumax(3) for ERANGE in case of non-prefixed string.
OK'd by: silence on current@ MFC after: 1 week
Notes
Notes: svn path=/head/; revision=254600
Diffstat (limited to 'lib/libutil/expand_number.c')
-rw-r--r--lib/libutil/expand_number.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libutil/expand_number.c b/lib/libutil/expand_number.c
index 5d55884d9ac5..0a62c12556a0 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;