libiwinfo: fix integer overflow in dbm to mw conversion, also allow odd dbm numbers
This commit is contained in:
parent
8cd629e148
commit
59992443bc
2 changed files with 3 additions and 3 deletions
|
@ -64,8 +64,8 @@ struct iwinfo_assoclist_entry {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct iwinfo_txpwrlist_entry {
|
struct iwinfo_txpwrlist_entry {
|
||||||
uint8_t dbm;
|
uint8_t dbm;
|
||||||
uint8_t mw;
|
uint16_t mw;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct iwinfo_freqlist_entry {
|
struct iwinfo_freqlist_entry {
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len)
|
||||||
{
|
{
|
||||||
for( dbm_cur = 0, dbm_cnt = 0;
|
for( dbm_cur = 0, dbm_cnt = 0;
|
||||||
dbm_cur < dbm_max;
|
dbm_cur < dbm_max;
|
||||||
dbm_cur += 2, dbm_cnt++ )
|
dbm_cur++, dbm_cnt++ )
|
||||||
{
|
{
|
||||||
entry.dbm = dbm_cur;
|
entry.dbm = dbm_cur;
|
||||||
entry.mw = iwinfo_dbm2mw(dbm_cur);
|
entry.mw = iwinfo_dbm2mw(dbm_cur);
|
||||||
|
|
Loading…
Reference in a new issue