Skip to content

Commit 5395249

Browse files
authored
[NXP] Fix access to SSID array (project-chip#36704)
Code is accessing the second slot of the ssid array. The size of ssid array in wifi_scan_params is set to 1 by default. Here the code is accessing the second slot of the array without taking into account the size.
1 parent 9fe0843 commit 5395249

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/platform/Zephyr/wifi/WiFiManager.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,11 @@ CHIP_ERROR WiFiManager::Scan(const ByteSpan & ssid, ScanResultCallback resultCal
216216
memcpy(mScanSsidBuffer, ssid.data(), ssid.size());
217217
mScanSsidBuffer[ssid.size()] = 0; // indicate the end of ssid string
218218
mScanParams.ssids[0] = mScanSsidBuffer;
219-
mScanParams.ssids[1] = nullptr; // indicate the end of ssids list
220-
scanParams = &mScanParams;
221-
scanParamsSize = sizeof(*scanParams);
219+
#if (CONFIG_WIFI_MGMT_SCAN_SSID_FILT_MAX > 1)
220+
mScanParams.ssids[1] = nullptr; // indicate the end of ssids list
221+
#endif
222+
scanParams = &mScanParams;
223+
scanParamsSize = sizeof(*scanParams);
222224
}
223225
if (0 != net_mgmt(NET_REQUEST_WIFI_SCAN, mNetIf, scanParams, scanParamsSize))
224226
{

0 commit comments

Comments
 (0)