Fix sched_scan filter setting for max_match_sets == 0

The previous implementation was trying to add the first SSID
to a zero-length array. Avoid this with an explicit validation
of the array length.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2011-11-25 18:12:04 +02:00 committed by Jouni Malinen
parent fb67eec6f8
commit fcd1684787

View file

@ -755,7 +755,8 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
continue;
}
if (params.filter_ssids && ssid->ssid && ssid->ssid_len) {
if (params.num_filter_ssids < wpa_s->max_match_sets &&
params.filter_ssids && ssid->ssid && ssid->ssid_len) {
wpa_dbg(wpa_s, MSG_DEBUG, "add to filter ssid: %s",
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
os_memcpy(params.filter_ssids[params.num_filter_ssids].ssid,