Skip to content

Commit

Permalink
Add errorhandling for keyMgmtsHendle
Browse files Browse the repository at this point in the history
  • Loading branch information
DamMicSzm committed Oct 6, 2023
1 parent aec4410 commit 2769a98
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/platform/Linux/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,8 +1560,10 @@ bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissi
GAutoPtr<const char *> keyMgmts(g_variant_get_strv(keyMgmt.get(), nullptr));
const gchar ** keyMgmtsHendle = keyMgmts.get();
uint8_t res = 0;
for (const gchar * keyMgmtVal = (keyMgmtsHendle != nullptr ? *keyMgmtsHendle : nullptr); keyMgmtVal != nullptr;
keyMgmtVal = *(++keyMgmtsHendle))

VerifyOrReturnError(keyMgmtsHendle != nullptr, res);

for (auto keyMgmtVal = *keyMgmtsHendle; keyMgmtVal != nullptr; keyMgmtVal = *(++keyMgmtsHendle))
{
if (g_strcasecmp(keyMgmtVal, "wpa-psk") == 0 || g_strcasecmp(keyMgmtVal, "wpa-none") == 0)
{
Expand All @@ -1588,8 +1590,10 @@ bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissi
GAutoPtr<const char *> keyMgmts(g_variant_get_strv(keyMgmt.get(), nullptr));
const gchar ** keyMgmtsHendle = keyMgmts.get();
uint8_t res = 0;
for (const gchar * keyMgmtVal = (keyMgmtsHendle != nullptr ? *keyMgmtsHendle : nullptr); keyMgmtVal != nullptr;
keyMgmtVal = *(++keyMgmtsHendle))

VerifyOrReturnError(keyMgmtsHendle != nullptr, res);

for (auto keyMgmtVal = *keyMgmtsHendle; keyMgmtVal != nullptr; keyMgmtVal = *(++keyMgmtsHendle))
{
if (g_strcasecmp(keyMgmtVal, "wpa-psk") == 0 || g_strcasecmp(keyMgmtVal, "wpa-psk-sha256") == 0 ||
g_strcasecmp(keyMgmtVal, "wpa-ft-psk") == 0)
Expand Down

0 comments on commit 2769a98

Please sign in to comment.