aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2019-02-23 11:50:47 (GMT)
committerJouni Malinen <j@w1.fi>2019-02-25 17:48:49 (GMT)
commitc4fccfc7a5dd75db8c28cab0ac27186d4598a995 (patch)
treeea0ed7a089ab54d6e34a45b987f178118fb848a0 /wpa_supplicant
parent1b85cad29c13347c2c4361c15132bd0371936e7a (diff)
downloadhostap-c4fccfc7a5dd75db8c28cab0ac27186d4598a995.zip
hostap-c4fccfc7a5dd75db8c28cab0ac27186d4598a995.tar.gz
hostap-c4fccfc7a5dd75db8c28cab0ac27186d4598a995.tar.bz2
UBSan: Avoid memcmp(ptr, NULL, 0)
Skip the memcmp() call if ssid_len == 0 and entry->ssid might be NULL to avoid an UBSan warning. wpa_supplicant.c:3956:9: runtime error: null pointer passed as argument 2, which is declared to never be null Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/wpa_supplicant.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c2e4218..20ae588 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3953,7 +3953,9 @@ struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s)
while (entry) {
if (!wpas_network_disabled(wpa_s, entry) &&
((ssid_len == entry->ssid_len &&
- os_memcmp(ssid, entry->ssid, ssid_len) == 0) || wired) &&
+ (!entry->ssid ||
+ os_memcmp(ssid, entry->ssid, ssid_len) == 0)) ||
+ wired) &&
(!entry->bssid_set ||
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
return entry;