wifi_hal: Check and update whitelist SSIDs lengths
whitelist SSIDs configured from framework have fixed length of 32 bytes
though they are null terminated with lesser lengths.
This commit is to update whitelist SSIDs lengths correctly before sending
to drvier.
Change-Id: I7ce41788250a26c69b481062e33588a338f27366
CRs-Fixed: 2595924
diff --git a/qcwcn/wifi_hal/roam.cpp b/qcwcn/wifi_hal/roam.cpp
index 9b38dba..7510280 100644
--- a/qcwcn/wifi_hal/roam.cpp
+++ b/qcwcn/wifi_hal/roam.cpp
@@ -308,6 +308,26 @@
info->capa.roaming_capa.max_whitelist_size);
return WIFI_ERROR_NOT_SUPPORTED;
}
+
+ // Framework is always sending SSID length as 32 though null terminated lengths
+ // are lesser. Thus update correct lengths before sending to driver.
+ for (int i = 0; i < roaming_config->num_whitelist_ssid; i++) {
+ int j;
+
+ for (j = 0; j < roaming_config->whitelist_ssid[i].length; j++) {
+ if (roaming_config->whitelist_ssid[i].ssid_str[j] == '\0')
+ break;
+ }
+
+ if (roaming_config->whitelist_ssid[i].length == j)
+ continue;
+
+ ALOGI("%s: ssid_str %s reported length = %d , null terminated length = %d", __FUNCTION__,
+ roaming_config->whitelist_ssid[i].ssid_str,
+ roaming_config->whitelist_ssid[i].length, j);
+ roaming_config->whitelist_ssid[i].length = j;
+ }
+
ret = wifi_set_ssid_white_list(requestId, iface, roaming_config->num_whitelist_ssid,
roaming_config->whitelist_ssid);
if (ret != WIFI_SUCCESS)