Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Feb 2013 07:58:52 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246821 - head/sys/netgraph
Message-ID:  <201302150758.r1F7wqJN059414@svn.freebsd.org>

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



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