Fix use-after-free in qca_nl80211_get_features am: 748cf248af am: 3f56ddf04d am: 969a019137
am: b03b4dc1df
Change-Id: I4fcdce24fe068e3165f7a8d993d06830398951c8
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 330679c..c2a5cfd 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -582,6 +582,11 @@
{
unsigned int i;
struct wpa_ssid *ssid;
+ /*
+ * For devices with |max_ssids| greater than 1, leave the last slot empty
+ * for adding the wildcard scan entry.
+ */
+ max_ssids = (max_ssids == 1) ? max_ssids : max_ssids - 1;
for (i = 0; i < wpa_s->scan_id_count; i++) {
unsigned int j;