nl80211: fix check for valid SSID size in scan operations
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 nl80211: fix check for valid SSID size in scan operations
In both trigger_scan and sched_scan operations, we were checking for the SSID length before assigning the value correctly. Since the memory was just kzalloc'ed, the check was always failing and SSID with over 32 characters were allowed to go through.
This was causing a buffer overflow when copying the actual SSID to the proper place.
This bug has been there since 2.6.29-rc4.
Backported from commit 208c72f4fe44fe09577e7975ba0e7fa0278f3d03.
--- net/wireless/nl80211.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/wireless/nl80211.c +1 -1
@@ -3239,12 +3239,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) i =0 ;if (info->attrs[NL80211_ATTR_SCAN_SSIDS ]) {nla_for_each_nested (attr, info->attrs[NL80211_ATTR_SCAN_SSIDS ], tmp) { + request->ssids[i].ssid_len =nla_len (attr);if (request->ssids[i].ssid_len >IEEE80211_MAX_SSID_LEN ) { err = -EINVAL ; goto out_free; }memcpy (request->ssids[i].ssid,nla_data (attr),nla_len (attr)); - request->ssids[i].ssid_len =nla_len (attr); i++; } }
Signature · 1 line
1.7.1
Quoted 8 lines · Luciano Coelho
In both
trigger_scanandsched_scanoperations, we were checking for the SSID length before assigning the value correctly. Since the memory was just kzalloc'ed, the check was always failing and SSID with over 32 characters were allowed to go through.This was causing a buffer overflow when copying the actual SSID to the proper place.
Quoted 8 lines
This bug has been there since 2.6.29-rc4.
Backported from commit
208c72f4fe44fe09577e7975ba0e7fa0278f3d03.Signed-off-by Luciano Coelho <[email protected]>Signed-off-by John W. Linville <[email protected]>---
FWIW, this patch applies cleanly on all stable kernels at least as far back as 2.6.35, probably even earlier.
Signature · 2 lines
Cheers, Luca.