fix handling of unknown country codes; atoi doesn't return -1

for an invalid string as I thought; so use strtol instead
This commit is contained in:
sam 2008-12-15 01:10:08 +00:00
parent 4cd355eb2d
commit b076937b92

View File

@ -1982,8 +1982,12 @@ DECL_CMD_FUNC(set80211country, val, d)
cc = lib80211_country_findbyname(rdp, val);
if (cc == NULL) {
cc = lib80211_country_findbycc(rdp, atoi(val));
if (cc == NULL)
char *eptr;
long code = strtol(val, &eptr, 0);
if (eptr != val)
cc = lib80211_country_findbycc(rdp, code);
if (eptr == val || cc == NULL)
errx(1, "unknown ISO country code %s", val);
}
getregdomain(s);