diff options
| author | Srinivas Girigowda <sgirigow@qca.qualcomm.com> | 2015-07-07 13:21:46 -0700 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2015-07-10 20:33:31 +0530 |
| commit | eac2ffbc9e900a94bb7a2577425ec31b07cf8eda (patch) | |
| tree | c70b16edea64a2677a747b5ffd8e087971b0a1ad | |
| parent | 95ddbebb8574e5037b846282ebe52788a474ea82 (diff) | |
qcacld-2.0: Fix buffer overwrite problem in GETCCXMODE
If (len + 1) is greater than priv_data.total_len then copy_to_user
results in writing more data than the buffer can hold.
Fix this by writing mininum of (len + 1) and priv_data.total_len.
Change-Id: Ibb765d280ee69930feee4aa221e30443d957f308
CRs-Fixed: 865574
| -rwxr-xr-x | CORE/HDD/src/wlan_hdd_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 3c4a4ae553e3..1c647b52ea33 100755 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -4502,8 +4502,8 @@ static int hdd_driver_command(hdd_adapter_t *pAdapter, len = scnprintf(extra, sizeof(extra), "%s %d", "GETCCXMODE", eseMode); - if (copy_to_user(priv_data.buf, &extra, len + 1)) - { + len = VOS_MIN(priv_data.total_len, len + 1); + if (copy_to_user(priv_data.buf, &extra, len)) { VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: failed to copy data to user buffer", __func__); ret = -EFAULT; |
