]> git.baikalelectronics.ru Git - kernel.git/commit
wifi: cfg80211: fix u8 overflow in cfg80211_update_notlisted_nontrans()
authorJohannes Berg <johannes.berg@intel.com>
Wed, 28 Sep 2022 19:56:15 +0000 (21:56 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 10 Oct 2022 07:49:52 +0000 (09:49 +0200)
commit13a319e89a24332c62670ad2035968dec23bc06c
treed86f40e07b9997801cb4f1cd0d60eeda5db34221
parent8f1f8b423ddc5e5080f91ee98ad36089e0c6744b
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 <shuster@seemoo.tu-darmstadt.de>
Tested-by: Soenke Huster <shuster@seemoo.tu-darmstadt.de>
Fixes: ac2a324087a0 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/scan.c