diff mbox

[RESEND] Dont exceed scan ssid max size advertised by driver

Message ID 1467325567-38100-1-git-send-email-rpius@google.com
State Accepted
Headers show

Commit Message

Roshan Pius June 30, 2016, 10:26 p.m. UTC
Currently |wpa_set_scan_ssids| fully exhausts
|wpa_driver_scan_params.ssid| list when hidden network ID's
are provided via the control interface. This results in us
exceeding the max size for the list advertised by the driver when we add
the "wildcard" scan ssid entry. So, ensure that we leave space for one
more scan ssid entry in the list when we exit out of |wpa_set_scan_ssids|.

Signed-off-by: Roshan Pius <rpius@google.com>
---
 wpa_supplicant/scan.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jouni Malinen July 3, 2016, 8:32 p.m. UTC | #1
On Thu, Jun 30, 2016 at 03:26:07PM -0700, Roshan Pius wrote:
> Currently |wpa_set_scan_ssids| fully exhausts
> |wpa_driver_scan_params.ssid| list when hidden network ID's
> are provided via the control interface. This results in us
> exceeding the max size for the list advertised by the driver when we add
> the "wildcard" scan ssid entry. So, ensure that we leave space for one
> more scan ssid entry in the list when we exit out of |wpa_set_scan_ssids|.

Thanks, applied. Though, I replaced the max_ssids == 1 check with a
check that matches the comment (i.e., max_ssids > 1 and reversed values)
to avoid any potential issues with max_ssids == 0.
diff mbox

Patch

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 @@  static void wpa_set_scan_ssids(struct wpa_supplicant *wpa_s,
 {
 	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;