svn commit: r254600 - head/lib/libutil

Sergey Kandaurov pluknet at FreeBSD.org
Wed Aug 21 16:46:07 UTC 2013


Author: pluknet
Date: Wed Aug 21 16:46:06 2013
New Revision: 254600
URL: http://svnweb.freebsd.org/changeset/base/254600

Log:
  Check strtoumax(3) for ERANGE in case of non-prefixed string.
  
  OK'd by:	silence on current@
  MFC after:	1 week

Modified:
  head/lib/libutil/expand_number.c

Modified: head/lib/libutil/expand_number.c
==============================================================================
--- head/lib/libutil/expand_number.c	Wed Aug 21 15:31:43 2013	(r254599)
+++ head/lib/libutil/expand_number.c	Wed Aug 21 16:46:06 2013	(r254600)
@@ -55,6 +55,10 @@ expand_number(const char *buf, uint64_t 
 
 	number = strtoumax(buf, &endptr, 0);
 
+	if (number == UINTMAX_MAX && errno == ERANGE) {
+		return (-1);
+	}
+
 	if (endptr == buf) {
 		/* No valid digits. */
 		errno = EINVAL;


More information about the svn-src-head mailing list