summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2013-02-15 07:58:51 +0000
committerglebius <glebius@FreeBSD.org>2013-02-15 07:58:51 +0000
commitb9bd38a43112efa17a63a6df3fb174f3d9e24256 (patch)
tree61b6013f8bfc3870e47173b4bc9218353635346c
parente3df6310d59bf27b62d1ac0dd781d10f50d351a6 (diff)
downloadFreeBSD-src-b9bd38a43112efa17a63a6df3fb174f3d9e24256.zip
FreeBSD-src-b9bd38a43112efa17a63a6df3fb174f3d9e24256.tar.gz
Fix compilation warning.
Sponsored by: Nginx, Inc
-rw-r--r--sys/netgraph/ng_parse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netgraph/ng_parse.c b/sys/netgraph/ng_parse.c
index e8cbc9a..10398bc 100644
--- a/sys/netgraph/ng_parse.c
+++ b/sys/netgraph/ng_parse.c
@@ -1236,6 +1236,7 @@ ng_parse_composite(const struct ng_parse_type *type, const char *s,
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_type *type, const char *s,
}
/* 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 */
OpenPOWER on IntegriCloud