Fixed parsing of unsigned integers.

This commit is contained in:
ru 2005-08-02 20:05:37 +00:00
parent c7ff05fb06
commit d763f91523

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