diff options
| author | Archana Ramachandran <archanar@codeaurora.org> | 2016-09-30 15:15:10 -0700 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-10-07 20:34:34 -0700 |
| commit | 1e6b9262adeae0f6fac78537759c34c0a0791b6c (patch) | |
| tree | 44edf2e89fc46f1d33bdb203569a350e15184ab5 | |
| parent | fa2d77387f947807144dfec6470ee2722a92c195 (diff) | |
qcacld-3.0: Add range check for P2P NOA request parameters
Add range check for P2P NOA parameters such as duration and
interval to prevent integer overflow from binary operation.
Change-Id: Iffa57d592af7ac6af7f67d80b85a276aa8faee4e
CRs-Fixed: 1072839
| -rw-r--r-- | core/hdd/src/wlan_hdd_p2p.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index ea3df68c7a47..1700a9c247c9 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -55,6 +55,7 @@ /* Ms to Time Unit Micro Sec */ #define MS_TO_TU_MUS(x) ((x) * 1024) +#define MAX_MUS_VAL (INT_MAX / 1024) static uint8_t *hdd_get_action_string(uint16_t MsgType) { @@ -1741,6 +1742,11 @@ int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command) ret); return -EINVAL; } + if (count < 0 || interval < 0 || duration < 0 || + interval > MAX_MUS_VAL || duration > MAX_MUS_VAL) { + hdd_err("Invalid NOA parameters"); + return -EINVAL; + } hdd_info("P2P_SET GO NoA: count=%d interval=%d duration=%d", count, interval, duration); duration = MS_TO_TU_MUS(duration); |
