Skip to content

Commit 9504a70

Browse files
jmberg-inteldinguyen702
authored andcommitted
wifi: cfg80211: fix u8 overflow in cfg80211_update_notlisted_nontrans()
[upstream commit aebe9f4] 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 441ed12 commit 9504a70

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
@@ -2238,7 +2238,7 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,
22382238
size_t new_ie_len;
22392239
struct cfg80211_bss_ies *new_ies;
22402240
const struct cfg80211_bss_ies *old;
2241-
u8 cpy_len;
2241+
size_t cpy_len;
22422242

22432243
lockdep_assert_held(&wiphy_to_rdev(wiphy)->bss_lock);
22442244

0 commit comments

Comments
 (0)