Skip to content

Commit 8afbd3c

Browse files
committed
wifi: cfg80211: fix u8 overflow in cfg80211_update_notlisted_nontrans()
jira VULN-3805 cve CVE-2022-41674 commit-author Johannes Berg <[email protected]> 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]> (cherry picked from commit aebe9f4) Signed-off-by: Brett Mastbergen <[email protected]>
1 parent b38d0a9 commit 8afbd3c

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
@@ -2240,7 +2240,7 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,
22402240
size_t new_ie_len;
22412241
struct cfg80211_bss_ies *new_ies;
22422242
const struct cfg80211_bss_ies *old;
2243-
u8 cpy_len;
2243+
size_t cpy_len;
22442244

22452245
lockdep_assert_held(&wiphy_to_rdev(wiphy)->bss_lock);
22462246

0 commit comments

Comments
 (0)