svn commit: r246821 - head/sys/netgraph

Gleb Smirnoff glebius at FreeBSD.org
Fri Feb 15 07:58:52 UTC 2013


Author: glebius
Date: Fri Feb 15 07:58:51 2013
New Revision: 246821
URL: http://svnweb.freebsd.org/changeset/base/246821

Log:
  Fix compilation warning.
  
  Sponsored by:	Nginx, Inc

Modified:
  head/sys/netgraph/ng_parse.c

Modified: head/sys/netgraph/ng_parse.c
==============================================================================
--- head/sys/netgraph/ng_parse.c	Fri Feb 15 07:13:27 2013	(r246820)
+++ head/sys/netgraph/ng_parse.c	Fri Feb 15 07:58:51 2013	(r246821)
@@ -1236,6 +1236,7 @@ ng_parse_composite(const struct ng_parse
 		   distinguish name from values by seeing if the next
 		   token is an equals sign */
 		if (ctype != CT_STRUCT) {
+			u_long ul;
 			int len2, off2;
 			char *eptr;
 
@@ -1259,11 +1260,12 @@ ng_parse_composite(const struct ng_parse
 			}
 
 			/* Index was specified explicitly; parse it */
-			index = (u_int)strtoul(s + *off, &eptr, 0);
-			if (index < 0 || eptr - (s + *off) != len) {
+			ul = strtoul(s + *off, &eptr, 0);
+			if (ul == ULONG_MAX || eptr - (s + *off) != len) {
 				error = EINVAL;
 				goto done;
 			}
+			index = (u_int)ul;
 			nextIndex = index + 1;
 			*off += len + len2;
 		} else {			/* a structure field */


More information about the svn-src-all mailing list