Message ID | 20240623084939.6889-1-aha310510@gmail.com |
---|---|
State | New |
Headers | show |
Series | [net] wifi: cfg80211: Fix out-of-bounds in cfg80211_wext_siwscan | expand |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 0222ede0feb6..f253dee041d1 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -3460,6 +3460,10 @@ int cfg80211_wext_siwscan(struct net_device *dev, if (wreq && wreq->num_channels) { int k; int wiphy_freq = wiphy->bands[band]->channels[j].center_freq; + + if (wreq->num_channels > IW_MAX_FREQUENCIES) + wreq->num_channels = IW_MAX_FREQUENCIES; + for (k = 0; k < wreq->num_channels; k++) { struct iw_freq *freq = &wreq->channel_list[k];