Staging: wlan-ng: cap the ssid length
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 31 Jan 2012 08:45:15 +0000 (11:45 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2012 17:51:47 +0000 (09:51 -0800)
We're getting the ssid length from the scan here.  Let's cap it before
doing the memcpy().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wlan-ng/prism2mgmt.c

index 6675c8226cefcc0b260517164e0835567fa7b1d5..c3bb05dd744fd5a0a81a811d67fa3b4e2d9fdfa7 100644 (file)
@@ -406,6 +406,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
        /* SSID */
        req->ssid.status = P80211ENUM_msgitem_status_data_ok;
        req->ssid.data.len = le16_to_cpu(item->ssid.len);
+       req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_BSSID_LEN);
        memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len);
 
        /* supported rates */