Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2013 16:46:06 +0000 (UTC)
From:      Sergey Kandaurov <pluknet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254600 - head/lib/libutil
Message-ID:  <201308211646.r7LGk6eV051215@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308211646.r7LGk6eV051215>