summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Girigowda <sgirigow@codeaurora.org>2016-12-12 18:45:32 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-12-15 05:47:47 -0800
commit948b0ce846c7ef643b0dc6702b80547aafe1a409 (patch)
tree8b0b3e562b4ae00a932ba983ba421a7a452335cb
parent27a0d5c4150bf73f9ddebfbc891884ffbbe1e7f9 (diff)
qcacld-2.0: Fix array out-of-bounds & integer underflow in _iw_set_genie
'wrqu->data.length' holds the total number of IE data buffer. Add a check to make sure the number of remaining data to be read is greater than or equal to IE length. Also, advance the buffer pointer to point to the next element only if next element is present. Change-Id: Ic60f3e0650f365955dab4099eb8740e9789e00cc CRs-Fixed: 1100132
-rw-r--r--CORE/HDD/src/wlan_hdd_wext.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 0549c3c2f70a..574b1efda53f 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -2755,6 +2755,13 @@ static int __iw_set_genie(struct net_device *dev, struct iw_request_info *info,
hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]",
__func__, elementId, eLen);
+ if (remLen < eLen) {
+ hddLog(LOGE, "Remaining len: %u less than ie len: %u",
+ remLen, eLen);
+ ret = -EINVAL;
+ goto exit;
+ }
+
switch ( elementId )
{
case IE_EID_VENDOR:
@@ -2837,8 +2844,11 @@ static int __iw_set_genie(struct net_device *dev, struct iw_request_info *info,
hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, elementId);
goto exit;
}
- genie += eLen;
remLen -= eLen;
+
+ /* Move genie only if next element is present */
+ if (remLen >= 2)
+ genie += eLen;
}
exit:
EXIT();