summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshish Kumar Dhanotiya <adhanoti@codeaurora.org>2019-12-23 15:31:06 +0530
committerHsiu-Chang Chen <hsiuchangchen@google.com>2020-04-08 13:30:57 +0800
commit614a30b3c2388e2b3325377ef60d5d122aa41aec (patch)
tree922f09393151e5b3c94fcd5fb475c52d20730a6a
parentf73885f5965f9bdb3c636d26a71349c2b0f614c7 (diff)
downloadqcacld-614a30b3c2388e2b3325377ef60d5d122aa41aec.tar.gz
qcacld-3.0: Validate assoc response IE len before copy
When host sends assoc response to supplicant, it allocates a buffer of fixed size and copies a variable length of assoc response IEs to this fixed sized buffer. There is a possibility of OOB write to the allocated buffer if the assoc response IEs length is greater than the allocated buffer size. To avoid above issue validate the assoc response IEs length with the allocated buffer size before data copy to the buffer. Bug: 153344687 Test: Regression test Change-ID: Ib12385e9ff04e5172ae8b505faf959e426fda439 CRs-Fixed: 2583124
-rw-r--r--core/hdd/src/wlan_hdd_assoc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index 632ea39bfa..b543894b5a 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -2202,8 +2202,9 @@ static void hdd_send_re_assoc_event(struct net_device *dev,
goto done;
}
- if (pCsrRoamInfo->nAssocRspLength == 0) {
- hdd_err("Assoc rsp length is 0");
+ if (pCsrRoamInfo->nAssocRspLength < FT_ASSOC_RSP_IES_OFFSET) {
+ hdd_err("Invalid assoc rsp length %d",
+ pCsrRoamInfo->nAssocRspLength);
goto done;
}
@@ -2233,6 +2234,10 @@ static void hdd_send_re_assoc_event(struct net_device *dev,
/* Send the Assoc Resp, the supplicant needs this for initial Auth */
len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
+ if (len > IW_GENERIC_IE_MAX) {
+ hdd_err("Invalid Assoc resp length %d", len);
+ goto done;
+ }
rspRsnLength = len;
qdf_mem_copy(rspRsnIe, pFTAssocRsp, len);
qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len);