aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-04-19 13:32:01 (GMT)
committerJouni Malinen <j@w1.fi>2015-04-22 19:05:11 (GMT)
commitf87c99c7874401bd5581b48ccf89a42eba360959 (patch)
treee8da7376e96873784d7563237a7ecccdbd813536
parentae7a42bde24f13d2a1324538713c50ca3afc9581 (diff)
downloadhostap-f87c99c7874401bd5581b48ccf89a42eba360959.zip
hostap-f87c99c7874401bd5581b48ccf89a42eba360959.tar.gz
hostap-f87c99c7874401bd5581b48ccf89a42eba360959.tar.bz2
Simplify DSSS Parameter Set element parsing
Check the element length in the parser and remove the length field from struct ieee802_11_elems since the only allowed element length is one. Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/ap/ap_list.c2
-rw-r--r--src/ap/beacon.c2
-rw-r--r--src/common/ieee802_11_common.c3
-rw-r--r--src/common/ieee802_11_common.h1
-rw-r--r--src/p2p/p2p_parse.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/ap/ap_list.c b/src/ap/ap_list.c
index 04a56a9..8cccd83 100644
--- a/src/ap/ap_list.c
+++ b/src/ap/ap_list.c
@@ -198,7 +198,7 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
else
ap->erp = -1;
- if (elems->ds_params && elems->ds_params_len == 1)
+ if (elems->ds_params)
ap->channel = elems->ds_params[0];
else if (elems->ht_operation && elems->ht_operation_len >= 1)
ap->channel = elems->ht_operation[0];
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index ad371f4..7009855 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -588,7 +588,7 @@ void handle_probe_req(struct hostapd_data *hapd,
* is less likely to see them (Probe Request frame sent on a
* neighboring, but partially overlapping, channel).
*/
- if (elems.ds_params && elems.ds_params_len == 1 &&
+ if (elems.ds_params &&
hapd->iface->current_mode &&
(hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G ||
hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211B) &&
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 350e955..140f920 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -211,8 +211,9 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
elems->supp_rates_len = elen;
break;
case WLAN_EID_DS_PARAMS:
+ if (elen < 1)
+ break;
elems->ds_params = pos;
- elems->ds_params_len = elen;
break;
case WLAN_EID_CF_PARAMS:
case WLAN_EID_TIM:
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index 7f0b296..0a71bc8 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -51,7 +51,6 @@ struct ieee802_11_elems {
u8 ssid_len;
u8 supp_rates_len;
- u8 ds_params_len;
u8 challenge_len;
u8 erp_info_len;
u8 ext_supp_rates_len;
diff --git a/src/p2p/p2p_parse.c b/src/p2p/p2p_parse.c
index def41ff..980dddf 100644
--- a/src/p2p/p2p_parse.c
+++ b/src/p2p/p2p_parse.c
@@ -516,7 +516,7 @@ int p2p_parse_ies(const u8 *data, size_t len, struct p2p_message *msg)
struct ieee802_11_elems elems;
ieee802_11_parse_elems(data, len, &elems, 0);
- if (elems.ds_params && elems.ds_params_len >= 1)
+ if (elems.ds_params)
msg->ds_params = elems.ds_params;
if (elems.ssid)
msg->ssid = elems.ssid - 2;