aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-10-20 09:10:39 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-23 10:13:20 +0200
commit44ec5d29169426b00fe054f0a13744140de29e11 (patch)
tree7386bd46141b1ff8b8deec5a28d419672f9c8633 /drivers/staging
parent883aeecc9ddc120e34a1157aee37738a4e96b517 (diff)
downloadkernel_goldelico_gta04-44ec5d29169426b00fe054f0a13744140de29e11.zip
kernel_goldelico_gta04-44ec5d29169426b00fe054f0a13744140de29e11.tar.gz
kernel_goldelico_gta04-44ec5d29169426b00fe054f0a13744140de29e11.tar.bz2
Staging: vt6656: add some range checks before memcpy()
We need to verify that we're not writing past the end of the array. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/vt6656/ioctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c
index 2cde4f0c..4939002 100644
--- a/drivers/staging/vt6656/ioctl.c
+++ b/drivers/staging/vt6656/ioctl.c
@@ -81,6 +81,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
}
pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid;
+ if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)
+ return -EINVAL;
if (pItemSSID->len != 0) {
memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
@@ -155,6 +157,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
}
pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid;
+ if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)
+ return -EINVAL;
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
if (sJoinCmd.wBSSType == ADHOC) {
@@ -476,6 +480,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
}
pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid;
+ if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)
+ return -EINVAL;
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);