mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
qcacld-2.0: Fix buffer overrun in function ProcSetReqInternal
In function ProcSetReqInternal, valueLen is obtained from the message buffer pParam. This valueLen is used as argument to the function GetStrValue where the contents of the buffer pParam is copied to pMac->cfg.gSBuffer for valueLen number of bytes. However the array pMac->cfg.gSBuffer is a static array of size CFG_MAX_STR_LEN. If the value of valueLen exceeds CFG_MAX_STR_LEN, a buffer overwrite will occur in GetStrValue. Add Sanity check to make sure valueLen does not exceed CFG_MAX_STR_LEN. Change-Id: Id16d4c4b8d2414c00a0fae8f8292f011d0763b84 CRs-Fixed: 2143847
This commit is contained in:
parent
448463a947
commit
82533270de
1 changed files with 2 additions and 1 deletions
|
@ -545,7 +545,8 @@ ProcSetReqInternal(tpAniSirGlobal pMac, tANI_U16 length, tANI_U32 *pParam, tANI_
|
|||
// Process string parameter
|
||||
else
|
||||
{
|
||||
if (valueLenRoundedUp4 > length)
|
||||
if ((valueLenRoundedUp4 > length) ||
|
||||
(valueLen > CFG_MAX_STR_LEN))
|
||||
{
|
||||
PELOGE(cfgLog(pMac, LOGE, FL("Invalid string length %d in set param %d (tot %d)"),
|
||||
valueLen, cfgId, length);)
|
||||
|
|
Loading…
Reference in a new issue