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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to