wifi: cfg80211: ensure length byte is present before access
authorJohannes Berg <johannes.berg@intel.com>
Thu, 29 Sep 2022 19:50:44 +0000 (21:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Oct 2022 05:59:03 +0000 (07:59 +0200)
commit9e99ca59ed3976921f8891c103d503b6da3e78af
treeb51d1b9fb87d6db70cc95405d0efae4dba171dff
parent0a861bd25dad508e492c48169509d8c6b9246895
wifi: cfg80211: ensure length byte is present before access

commit 567e14e39e8f8c6997a1378bc3be615afca86063 upstream.

When iterating the elements here, ensure the length byte is
present before checking it to see if the entire element will
fit into the buffer.

Longer term, we should rewrite this code using the type-safe
element iteration macros that check all of this.

Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Reported-by: Soenke Huster <shuster@seemoo.tu-darmstadt.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/wireless/scan.c