> no need to check if unsigned value is smaller than zero. Please see the > attached patch. > > Gmail likely mangles the inlined patch but here it goes: > --- brconfig.c.old Wed Jan 13 16:35:39 2016 > +++ brconfig.c Wed Jan 13 16:36:26 2016 > @@ -563,7 +563,7 @@ bridge_ifcost(const char *ifname, const char *val) > errno = 0; > v = strtoul(val, &endptr, 0); > if (val[0] == '\0' || endptr[0] != '\0' || > - v < 0 || v > 0xffffffffUL || > + v > 0xffffffffUL || > (errno == ERANGE && v == ULONG_MAX)) > errx(1, "invalid arg for ifcost: %s", val);
It would be better to (very carefully) refactor almost all of those to strtonum. After such a change operands must be in decimal. Octal / hex become unacceptable. From a user perspective that is the right thing to do, meaning "base == 0" can be looked upon as an error in the original code. Overly flexible code is not smart code. (Where's my binary support??? Where is my ability to pass in a base64 encoded number??)
