public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Staging: wlan-ng: cap the ssid length
@ 2012-01-31  8:45 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-01-31  8:45 UTC (permalink / raw)
  To: kernel-janitors

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>
---
This is a static analysis patch.  I don't have the hardware to test it.

diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
index 6675c82..c3bb05d 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -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 */

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-31  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-31  8:45 [patch] Staging: wlan-ng: cap the ssid length Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox