Fixed parsing of unsigned integers.

This commit is contained in:
Ruslan Ermilov 2005-08-02 20:05:37 +00:00
parent 2319835713
commit 91b756f435

View file

@ -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);