mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 16:16:15 -04:00
qcacld-3.0: Possible OOB read when parsing FT IE
FTIE buffer carries multiple FT subelements (like R1KH-ID, R0KH-ID, GTK, IGTK, etc). Total FTIE buffer len = Number of FT subelements * (Subelement ID (1 bytes) + lenght (1 bytes) + data length). Currently, Host checks only the minimum length for FTIE buffer while filling each FT subelements. This leads to OOB if the remaining length of FTIE length buffer less than the length of an FT subelement. Before filling each subelement into FTIE buffer, add a check to validate subelement length against remaining FTIE length Change-Id: I5d6f4a59eef591d3a2da9f2403738d1fdd1a88b2 CRs-Fixed: 2857084
This commit is contained in:
parent
5095db9964
commit
943ff67ea3
1 changed files with 13 additions and 2 deletions
|
|
@ -2984,7 +2984,7 @@ QDF_STATUS wlan_parse_ftie_sha384(uint8_t *frame, uint32_t frame_len,
|
|||
struct sSirAssocRsp *assoc_rsp)
|
||||
{
|
||||
const uint8_t *ie, *ie_end, *pos;
|
||||
uint8_t ie_len;
|
||||
uint8_t ie_len, remaining_ie_len;
|
||||
struct wlan_sha384_ftinfo_subelem *ft_subelem;
|
||||
|
||||
ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_FTINFO, frame, frame_len);
|
||||
|
|
@ -3003,11 +3003,13 @@ QDF_STATUS wlan_parse_ftie_sha384(uint8_t *frame, uint32_t frame_len,
|
|||
pe_err("Invalid FTIE len:%d", ie_len);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
remaining_ie_len = ie_len;
|
||||
pos = ie + 2;
|
||||
qdf_mem_copy(&assoc_rsp->sha384_ft_info, pos,
|
||||
sizeof(struct wlan_sha384_ftinfo));
|
||||
ie_end = ie + ie_len;
|
||||
pos += sizeof(struct wlan_sha384_ftinfo);
|
||||
remaining_ie_len -= sizeof(struct wlan_sha384_ftinfo);
|
||||
ft_subelem = &assoc_rsp->sha384_ft_subelem;
|
||||
qdf_mem_zero(ft_subelem, sizeof(*ft_subelem));
|
||||
while (ie_end - pos >= 2) {
|
||||
|
|
@ -3015,11 +3017,20 @@ QDF_STATUS wlan_parse_ftie_sha384(uint8_t *frame, uint32_t frame_len,
|
|||
|
||||
id = *pos++;
|
||||
len = *pos++;
|
||||
if (len < 1) {
|
||||
/* Subtract data length(len) + 1 bytes for
|
||||
* Subelement ID + 1 bytes for length from
|
||||
* remaining FTIE buffer len (ie_len).
|
||||
* Subelement Parameter(s) field :
|
||||
* Subelement ID Length Data
|
||||
* Octets: 1 1 variable
|
||||
*/
|
||||
if (len < 1 || remaining_ie_len < (len + 2)) {
|
||||
pe_err("Invalid FT subelem length");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
remaining_ie_len -= (len + 2);
|
||||
|
||||
switch (id) {
|
||||
case FTIE_SUBELEM_R1KH_ID:
|
||||
if (len != FTIE_R1KH_LEN) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue