Skip to content

Commit aebe9f4

Browse files
committed
wifi: cfg80211: fix u8 overflow in cfg80211_update_notlisted_nontrans()
In the copy code of the elements, we do the following calculation to reach the end of the MBSSID element: /* copy the IEs after MBSSID */ cpy_len = mbssid[1] + 2; This looks fine, however, cpy_len is a u8, the same as mbssid[1], so the addition of two can overflow. In this case the subsequent memcpy() will overflow the allocated buffer, since it copies 256 bytes too much due to the way the allocation and memcpy() sizes are calculated. Fix this by using size_t for the cpy_len variable. This fixes CVE-2022-41674. Reported-by: Soenke Huster <[email protected]> Tested-by: Soenke Huster <[email protected]> Fixes: 0b8fb82 ("cfg80211: Parsing of Multiple BSSID information in scanning") Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent af7d23f commit aebe9f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/wireless/scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,
22792279
size_t new_ie_len;
22802280
struct cfg80211_bss_ies *new_ies;
22812281
const struct cfg80211_bss_ies *old;
2282-
u8 cpy_len;
2282+
size_t cpy_len;
22832283

22842284
lockdep_assert_held(&wiphy_to_rdev(wiphy)->bss_lock);
22852285

0 commit comments

Comments
 (0)