mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-18 04:54:52 +00:00
wifi: wilc1000: validate length of IEEE80211_P2P_ATTR_CHANNEL_LIST attribute
Validate that the IEEE80211_P2P_ATTR_CHANNEL_LIST attribute contains enough space for a 'struct wilc_attr_oper_ch'. If the attribute is too small then it can trigger an out-of-bounds write later in the function. 'struct wilc_attr_oper_ch' is variable sized so also check 'attr_len' does not extend beyond the end of 'buf'. Signed-off-by: Phil Turnbull <philipturnbull@github.com> Tested-by: Ajay Kathat <ajay.kathat@microchip.com> Acked-by: Ajay Kathat <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20221123153543.8568-4-philipturnbull@github.com
This commit is contained in:
parent
051ae669e4
commit
f9b62f9843
1 changed files with 2 additions and 1 deletions
|
@ -967,7 +967,8 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u32 len, u8 sta_ch)
|
|||
if (index + sizeof(*e) + attr_size > len)
|
||||
return;
|
||||
|
||||
if (e->attr_type == IEEE80211_P2P_ATTR_CHANNEL_LIST)
|
||||
if (e->attr_type == IEEE80211_P2P_ATTR_CHANNEL_LIST &&
|
||||
attr_size >= (sizeof(struct wilc_attr_ch_list) - sizeof(*e)))
|
||||
ch_list_idx = index;
|
||||
else if (e->attr_type == IEEE80211_P2P_ATTR_OPER_CHANNEL &&
|
||||
attr_size == (sizeof(struct wilc_attr_oper_ch) - sizeof(*e)))
|
||||
|
|
Loading…
Add table
Reference in a new issue