From: Antonio Quartulli Date: Fri, 26 Oct 2012 16:54:25 +0000 (+0200) Subject: mac80211: fix SSID copy on IBSS JOIN X-Git-Tag: v3.2.34~56 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e03a4913b8696586da297393a752c3b0a6b01314;p=karo-tx-linux.git mac80211: fix SSID copy on IBSS JOIN commit badecb001a310408d3473b1fc2ed5aefd0bc92a9 upstream. The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and its length is likely to be less than IEEE80211_MAX_SSID_LEN most of the time. This patch fixes the ssid copy in ieee80211_ibss_join() by using the SSID length to prevent it from reading beyond the string. Signed-off-by: Antonio Quartulli [rewrapped commit message, small rewording] Signed-off-by: Johannes Berg Signed-off-by: Ben Hutchings --- diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 3ece106d5660..8c7364b81836 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -940,7 +940,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);