mac80211: check ERP info IE length in parser
authorJohannes Berg <johannes.berg@intel.com>
Wed, 27 Mar 2013 13:31:53 +0000 (14:31 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 8 Apr 2013 07:16:57 +0000 (09:16 +0200)
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>
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c
net/mac80211/scan.c
net/mac80211/util.c

index eccd1d805ecc7d1d9fac7a91e5b8545cfe27ae78..6ad019d32623d5e9aea6e62979784d44a8072bd9 100644 (file)
@@ -1189,7 +1189,6 @@ struct ieee802_11_elems {
        u8 tim_len;
        u8 challenge_len;
        u8 rsn_len;
-       u8 erp_info_len;
        u8 ext_supp_rates_len;
        u8 wmm_info_len;
        u8 wmm_param_len;
index f76c58fb3bdcfa3d9a74747007492aff6ee97040..157d951df7a42df8b52bed012dd1f8c3e6631c26 100644 (file)
@@ -3038,7 +3038,7 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
                changed |= BSS_CHANGED_DTIM_PERIOD;
        }
 
-       if (elems.erp_info && elems.erp_info_len >= 1) {
+       if (elems.erp_info) {
                erp_valid = true;
                erp_value = elems.erp_info[0];
        } else {
index 581764f92e13ae529233e83eb9fc7d4999676602..33fbf104569047826078c4d528c5b7d0e14abdd2 100644 (file)
@@ -98,9 +98,8 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
        }
 
        /* save the ERP value so that it is available at association time */
-       if (elems->erp_info && elems->erp_info_len >= 1 &&
-                       (!elems->parse_error ||
-                        !(bss->valid_data & IEEE80211_BSS_VALID_ERP))) {
+       if (elems->erp_info && (!elems->parse_error ||
+                               !(bss->valid_data & IEEE80211_BSS_VALID_ERP))) {
                bss->erp_value = elems->erp_info[0];
                bss->has_erp_value = true;
                if (!elems->parse_error)
index 0f7d1c20f8acfd53004e9214f20f1df0630b0f63..4839dec5c9ac47e847170f822773b809384330f8 100644 (file)
@@ -780,8 +780,10 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
                        elems->rsn_len = elen;
                        break;
                case WLAN_EID_ERP_INFO:
-                       elems->erp_info = pos;
-                       elems->erp_info_len = elen;
+                       if (elen >= 1)
+                               elems->erp_info = pos;
+                       else
+                               elem_parse_failed = true;
                        break;
                case WLAN_EID_EXT_SUPP_RATES:
                        elems->ext_supp_rates = pos;