Skip to content

Commit

Permalink
prima: Add buf len check in wlan_hdd_cfg80211_testmode
Browse files Browse the repository at this point in the history
In __wlan_hdd_cfg80211_testmode API no checks are in place that
ensure that buflen is smaller or equal the size of the stack
variable hb_params. Hence, the vos_mem_copy() call can overflow
stack memory.

Add buf len check to avoid stack overflow

CRs-Fixed: 1105085
Change-Id: I6af6a74cc38ebce3337120adcf7e9595f22d3d8c
  • Loading branch information
Manjeet Singh authored and andi34 committed Jul 31, 2017
1 parent f3df6c7 commit 115664c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -16579,6 +16579,12 @@ static int __wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len
(hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0))
return -EINVAL;

if (buf_len > sizeof(*hb_params)) {
hddLog(LOGE, FL("buf_len=%d exceeded hb_params size limit"),
buf_len);
return -ERANGE;
}

hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq));
if (NULL == hb_params)
{
Expand Down

0 comments on commit 115664c

Please sign in to comment.