Skip to content

Commit

Permalink
[wifi] dont store wifi info in kvs if ssid is empty (#24719)
Browse files Browse the repository at this point in the history
- also initialize WifiNetwork structs to empty
  • Loading branch information
pankore authored and pull[bot] committed Jul 17, 2023
1 parent 303a883 commit 4879eac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/platform/Ameba/AmebaUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ CHIP_ERROR AmebaUtils::EnableStationMode(void)
CHIP_ERROR AmebaUtils::SetWiFiConfig(rtw_wifi_config_t * config)
{
CHIP_ERROR err = CHIP_NO_ERROR;
// don't store if ssid is null
if (config->ssid[0] == 0)
{
return CHIP_NO_ERROR;
}

/* Store Wi-Fi Configurations in Storage */
err = PersistedStorage::KeyValueStoreMgr().Put(kWiFiSSIDKeyName, config->ssid, sizeof(config->ssid));
SuccessOrExit(err);
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Ameba/NetworkCommissioningDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ class AmebaWiFiDriver final : public WiFiDriver
bool NetworkMatch(const WiFiNetwork & network, ByteSpan networkId);
CHIP_ERROR StartScanWiFiNetworks(ByteSpan ssid);

WiFiNetwork mSavedNetwork;
WiFiNetwork mStagingNetwork;
WiFiNetwork mSavedNetwork = { 0 };
WiFiNetwork mStagingNetwork = { 0 };
ScanCallback * mpScanCallback;
ConnectCallback * mpConnectCallback;
NetworkStatusChangeCallback * mpStatusChangeCallback = nullptr;
Expand Down

0 comments on commit 4879eac

Please sign in to comment.