DO NOT MERGE Dont exceed scan ssid max size advertised by driver
am: e382b88dde

Change-Id: Iafc6484642282eb7872719a28f2a0072ad93aeee
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 7a52826..7f42607 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -575,6 +575,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;