qcacld-3.0: Fix potential buffer overflow in wlan_hdd_cfg80211_set_ie

In function wlan_hdd_cfg80211_set_ie, RSN IE is parsed and copied
into the buffer  for length eLen + 2.
However, the buffer WPARSNIE is allocated only for
size. If eLen + 2 is greater than MAX_WPA_RSN_IE_LEN, a buffer overflow
would occur.

Add sanity check to make sure eLen does not exceed MAX_WPA_RSN_IE_LEN - 2.
Also increase the size of  to 255 as per the spec

Change-Id: Ibf44e8dc1010e6e32b2262357d3aa180926d5c99
CRs-Fixed: 2154216
This commit is contained in:
Vignesh Viswanathan
2017-12-05 19:42:46 +05:30
committed by snandini
父節點 3b0c91e96e
當前提交 96e0e702ec
共有 2 個文件被更改,包括 6 次插入1 次删除

查看文件

@@ -153,7 +153,7 @@ enum hdd_wlan_wmm_ts_info_ack_policy {
};
/** Maximum Length of WPA/RSN IE */
#define MAX_WPA_RSN_IE_LEN 40
#define MAX_WPA_RSN_IE_LEN 255
/** Enable 11d */
#define ENABLE_11D 1

查看文件

@@ -16889,6 +16889,11 @@ static int wlan_hdd_cfg80211_set_ie(struct hdd_adapter *adapter,
break;
case DOT11F_EID_RSN:
hdd_debug("Set RSN IE(len %d)", eLen + 2);
if (eLen > (MAX_WPA_RSN_IE_LEN - 2)) {
hdd_err("%s: Invalid WPA RSN IE length[%d]",
__func__, eLen);
return -EINVAL;
}
memset(pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN);
memcpy(pWextState->WPARSNIE, genie - 2,
(eLen + 2));