From: Jo-Philipp Wich Date: Sat, 5 Feb 2011 18:20:48 +0000 (+0000) Subject: libiwinfo: fix integer overflow in dbm to mw conversion, also allow odd dbm numbers X-Git-Tag: 0.11.0~2293 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=59992443bc0bc57b9601940824cbe1f285be07b9;p=oweals%2Fluci.git libiwinfo: fix integer overflow in dbm to mw conversion, also allow odd dbm numbers --- diff --git a/contrib/package/iwinfo/src/iwinfo.h b/contrib/package/iwinfo/src/iwinfo.h index a9889bd9f..aa2f8335a 100644 --- a/contrib/package/iwinfo/src/iwinfo.h +++ b/contrib/package/iwinfo/src/iwinfo.h @@ -64,8 +64,8 @@ struct iwinfo_assoclist_entry { }; struct iwinfo_txpwrlist_entry { - uint8_t dbm; - uint8_t mw; + uint8_t dbm; + uint16_t mw; }; struct iwinfo_freqlist_entry { diff --git a/contrib/package/iwinfo/src/iwinfo_nl80211.c b/contrib/package/iwinfo/src/iwinfo_nl80211.c index fa714e906..0f57d37f1 100644 --- a/contrib/package/iwinfo/src/iwinfo_nl80211.c +++ b/contrib/package/iwinfo/src/iwinfo_nl80211.c @@ -1170,7 +1170,7 @@ int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len) { for( dbm_cur = 0, dbm_cnt = 0; dbm_cur < dbm_max; - dbm_cur += 2, dbm_cnt++ ) + dbm_cur++, dbm_cnt++ ) { entry.dbm = dbm_cur; entry.mw = iwinfo_dbm2mw(dbm_cur);