mac80211: check ERP info IE length in parser

It's always just one byte, so check for that and
remove the length field from the parser struct.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2013-03-27 14:31:53 +01:00
parent 1cd8e88e17
commit 1946bed957
4 changed files with 7 additions and 7 deletions

View File

@ -1189,7 +1189,6 @@ struct ieee802_11_elems {
u8 tim_len; u8 tim_len;
u8 challenge_len; u8 challenge_len;
u8 rsn_len; u8 rsn_len;
u8 erp_info_len;
u8 ext_supp_rates_len; u8 ext_supp_rates_len;
u8 wmm_info_len; u8 wmm_info_len;
u8 wmm_param_len; u8 wmm_param_len;

View File

@ -3038,7 +3038,7 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
changed |= BSS_CHANGED_DTIM_PERIOD; changed |= BSS_CHANGED_DTIM_PERIOD;
} }
if (elems.erp_info && elems.erp_info_len >= 1) { if (elems.erp_info) {
erp_valid = true; erp_valid = true;
erp_value = elems.erp_info[0]; erp_value = elems.erp_info[0];
} else { } else {

View File

@ -98,8 +98,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
} }
/* save the ERP value so that it is available at association time */ /* save the ERP value so that it is available at association time */
if (elems->erp_info && elems->erp_info_len >= 1 && if (elems->erp_info && (!elems->parse_error ||
(!elems->parse_error ||
!(bss->valid_data & IEEE80211_BSS_VALID_ERP))) { !(bss->valid_data & IEEE80211_BSS_VALID_ERP))) {
bss->erp_value = elems->erp_info[0]; bss->erp_value = elems->erp_info[0];
bss->has_erp_value = true; bss->has_erp_value = true;

View File

@ -780,8 +780,10 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
elems->rsn_len = elen; elems->rsn_len = elen;
break; break;
case WLAN_EID_ERP_INFO: case WLAN_EID_ERP_INFO:
if (elen >= 1)
elems->erp_info = pos; elems->erp_info = pos;
elems->erp_info_len = elen; else
elem_parse_failed = true;
break; break;
case WLAN_EID_EXT_SUPP_RATES: case WLAN_EID_EXT_SUPP_RATES:
elems->ext_supp_rates = pos; elems->ext_supp_rates = pos;