Date: Wed, 19 Nov 2008 19:00:07 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 153226 for review Message-ID: <200811191900.mAJJ0727050511@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=153226 Change 153226 by sam@sam_ebb on 2008/11/19 19:00:00 fix handling of unknown country codes; atoi doesn't return -1 for an invalid string as I thought; so use strtol instead Affected files ... .. //depot/projects/vap/sbin/ifconfig/ifieee80211.c#32 edit Differences ... ==== //depot/projects/vap/sbin/ifconfig/ifieee80211.c#32 (text+ko) ==== @@ -1981,8 +1981,12 @@ 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811191900.mAJJ0727050511>