Skip to content

Commit a3e6c67

Browse files
committed
Check if SSID and BSSID properties were fetched
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().
1 parent f2cd15f commit a3e6c67

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/platform/Linux/ConnectivityManagerImpl.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,13 @@ bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissi
15491549
std::unique_ptr<GVariant, GVariantDeleter> ssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "SSID"));
15501550
std::unique_ptr<GVariant, GVariantDeleter> bssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "BSSID"));
15511551

1552+
// Network scan is performed in the background, so the BSS
1553+
// may be gone when we try to get the properties.
1554+
if (ssid == nullptr || bssid == nullptr)
1555+
{
1556+
return false;
1557+
}
1558+
15521559
const guchar * ssidStr = nullptr;
15531560
const guchar * bssidBuf = nullptr;
15541561
char bssidStr[2 * 6 + 5 + 1] = { 0 };

src/platform/webos/ConnectivityManagerImpl.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,13 @@ bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissi
15181518
std::unique_ptr<GVariant, GVariantDeleter> ssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "SSID"));
15191519
std::unique_ptr<GVariant, GVariantDeleter> bssid(g_dbus_proxy_get_cached_property(G_DBUS_PROXY(bssProxy), "BSSID"));
15201520

1521+
// Network scan is performed in the background, so the BSS
1522+
// may be gone when we try to get the properties.
1523+
if (ssid == nullptr || bssid == nullptr)
1524+
{
1525+
return false;
1526+
}
1527+
15211528
const guchar * ssidStr = nullptr;
15221529
const guchar * bssidBuf = nullptr;
15231530
char bssidStr[2 * 6 + 5 + 1] = { 0 };

0 commit comments

Comments
 (0)