Skip to content

Commit

Permalink
Check if SSID and BSSID properties were fetched (#22930)
Browse files Browse the repository at this point in the history
Network scan is performed in the background by wpa_supplicant. When
we are trying to get BSS properties, the BSS may be already gone. This
patch prevents passing NULL to g_variant_get_fixed_array().
  • Loading branch information
arkq authored and pull[bot] committed Mar 10, 2023
1 parent 602eb87 commit 1075259
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/platform/Linux/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,14 @@ bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissi
std::unique_ptr<GVariant, GVariantDeleter> ssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "SSID"));
std::unique_ptr<GVariant, GVariantDeleter> bssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "BSSID"));

// Network scan is performed in the background, so the BSS
// may be gone when we try to get the properties.
if (ssid == nullptr || bssid == nullptr)
{
ChipLogDetail(DeviceLayer, "wpa_supplicant: BSS not found: %s", bssPath);
return false;
}

const guchar * ssidStr = nullptr;
const guchar * bssidBuf = nullptr;
char bssidStr[2 * 6 + 5 + 1] = { 0 };
Expand Down
8 changes: 8 additions & 0 deletions src/platform/webos/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,14 @@ bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissi
std::unique_ptr<GVariant, GVariantDeleter> ssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "SSID"));
std::unique_ptr<GVariant, GVariantDeleter> bssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "BSSID"));

// Network scan is performed in the background, so the BSS
// may be gone when we try to get the properties.
if (ssid == nullptr || bssid == nullptr)
{
ChipLogDetail(DeviceLayer, "wpa_supplicant: BSS not found: %s", bssPath);
return false;
}

const guchar * ssidStr = nullptr;
const guchar * bssidBuf = nullptr;
char bssidStr[2 * 6 + 5 + 1] = { 0 };
Expand Down

0 comments on commit 1075259

Please sign in to comment.