From 91b756f4359ec2a5198d7a380bdd3af082fb261d Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 2 Aug 2005 20:05:37 +0000 Subject: [PATCH] Fixed parsing of unsigned integers. --- sys/netgraph/ng_parse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netgraph/ng_parse.c b/sys/netgraph/ng_parse.c index dabe1ca22f0..0687937ae23 100644 --- a/sys/netgraph/ng_parse.c +++ b/sys/netgraph/ng_parse.c @@ -535,7 +535,10 @@ ng_int32_parse(const struct ng_parse_type *type, int32_t val32; char *eptr; - val = strtol(s + *off, &eptr, 0); + if ((intptr_t)type->info == INT_SIGNED) + val = strtol(s + *off, &eptr, 0); + else + val = strtoul(s + *off, &eptr, 0); if (val < (int32_t)0x80000000 || val > (u_int32_t)0xffffffff || eptr == s + *off) return (EINVAL);