summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2011-05-06 11:25:35 +0300
committerLuciano Coelho <coelho@ti.com>2011-05-06 11:25:35 +0300
commit67f919d0694e345dabce022f18cc6a4bd3f32c9c (patch)
treeec8a3707c0286a2a033a5ec2e50265e9028e3aa0
parent66fec2366031cb021885d795485a86fc8d7c9f4a (diff)
parent3d5e49b63f91e43eaf4ab44d7c2ad8d2f1609b3b (diff)
Merge branch 'wl12xx-next'wl12xx-2011-05-06
-rw-r--r--drivers/net/wireless/wl12xx/main.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 6dab6f0c91b..f82e736ba19 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2376,20 +2376,24 @@ out:
static int wl1271_ssid_set(struct wl1271 *wl, struct sk_buff *skb,
int offset)
{
- u8 *ptr = skb->data + offset;
+ u8 ssid_len;
+ const u8 *ptr = cfg80211_find_ie(WLAN_EID_SSID, skb->data + offset,
+ skb->len - offset);
- /* find the location of the ssid in the beacon */
- while (ptr < skb->data + skb->len) {
- if (ptr[0] == WLAN_EID_SSID) {
- wl->ssid_len = ptr[1];
- memcpy(wl->ssid, ptr+2, wl->ssid_len);
- return 0;
- }
- ptr += (ptr[1] + 2);
+ if (!ptr) {
+ wl1271_error("No SSID in IEs!");
+ return -ENOENT;
}
- wl1271_error("No SSID in IEs!\n");
- return -ENOENT;
+ ssid_len = ptr[1];
+ if (ssid_len > IEEE80211_MAX_SSID_LEN) {
+ wl1271_error("SSID is too long!");
+ return -EINVAL;
+ }
+
+ wl->ssid_len = ssid_len;
+ memcpy(wl->ssid, ptr+2, ssid_len);
+ return 0;
}
static int wl1271_bss_erp_info_changed(struct wl1271 *wl,