diff mbox

[mac80211] mac80211: fix SSID copy on IBSS JOIN

Message ID 1351270465-18946-1-git-send-email-ordex@autistici.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Antonio Quartulli Oct. 26, 2012, 4:54 p.m. UTC
The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and therefore the
length is likely to be less than IEEE80211_MAX_SSID_LEN most of the times.

This patch fixes the ssid copy in ieee80211_ibss_join() by preventing it from
reading beyond the string.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/mac80211/ibss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Berg Oct. 26, 2012, 8:51 p.m. UTC | #1
On Fri, 2012-10-26 at 18:54 +0200, Antonio Quartulli wrote:
> The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and therefore the
> length is likely to be less than IEEE80211_MAX_SSID_LEN most of the times.
> 
> This patch fixes the ssid copy in ieee80211_ibss_join() by preventing it from
> reading beyond the string.
> 
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>

Applied, I also added Cc stable since this goes back a long time.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 5f3620f..bf87c70 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1108,7 +1108,7 @@  int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
 	sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
 	sdata->u.ibss.ibss_join_req = jiffies;
 
-	memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN);
+	memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len);
 	sdata->u.ibss.ssid_len = params->ssid_len;
 
 	mutex_unlock(&sdata->u.ibss.mtx);