summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Girigowda <sgirigow@qca.qualcomm.com>2015-07-06 19:16:54 -0700
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2015-07-10 20:33:31 +0530
commitf497c032c18fa67787c1215bd34c9818d2e546bb (patch)
treebdc50b7fc565cd76022789f250711f03b7f44424
parent438a88555bfa02b295070dc96b268d79d9a037d8 (diff)
qcacld-2.0: Fix buffer overwrite problem in GETROAMTRIGGER
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: I545df0d5eff4c6296359029c1a78e66e37574b4d CRs-Fixed: 865611
-rwxr-xr-xCORE/HDD/src/wlan_hdd_main.c4
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 e2f28f702223..c071ec60127a 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -4115,8 +4115,8 @@ static int hdd_driver_command(hdd_adapter_t *pAdapter,
TRACE_CODE_HDD_GETROAMTRIGGER_IOCTL,
pAdapter->sessionId, lookUpThreshold));
len = scnprintf(extra, sizeof(extra), "%s %d", command, rssi);
- 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;