diff options
| author | Pragaspathi Thilagaraj <tpragasp@codeaurora.org> | 2019-12-05 19:55:28 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2021-01-06 03:30:44 -0800 |
| commit | d82d4b1fc7fabc2e720f29d461cdba8f1def4223 (patch) | |
| tree | 5b66e5db4a2795e2d5108518e6ac9ef3d3b27080 | |
| parent | 511f7a3487e32c2ca0195849f181ca65fa1a6028 (diff) | |
qcacld-3.0: Fix integer overflow in rrm_fill_beacon_ies()
In function rrm_fill_beacon_ies, the total IE length is
calculated as sum of length field of the IE and 2 (element id 1
byte and IE length field 1 byte). The total IE length is defined
of type uint16_t and will overflow if the *(pBcnIes + 1)=0xfe.
Validate the len against total IE length to avoid overflow.
Change-Id: If8f86952ce43c5923906fc6ef18705f1785c5d88
CRs-Fixed: 2573329
| -rw-r--r-- | core/mac/src/pe/rrm/rrm_api.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/mac/src/pe/rrm/rrm_api.c b/core/mac/src/pe/rrm/rrm_api.c index 00142a4a6f28..e600d1efd47b 100644 --- a/core/mac/src/pe/rrm/rrm_api.c +++ b/core/mac/src/pe/rrm/rrm_api.c @@ -747,12 +747,19 @@ rrm_fill_beacon_ies(tpAniSirGlobal pMac, } while (BcnNumIes > 0) { - len = *(pBcnIes + 1) + 2; /* element id + length. */ + len = *(pBcnIes + 1); + len += 2; /* element id + length. */ pe_debug("EID = %d, len = %d total = %d", *pBcnIes, *(pBcnIes + 1), len); - if (!len) { - pe_err("Invalid length"); + if (BcnNumIes < len) { + pe_err("RRM: Invalid IE len:%d exp_len:%d", + len, BcnNumIes); + break; + } + + if (len <= 2) { + pe_err("RRM: Invalid IE"); break; } |
