D-Bus: Make the CurrentAuthMode property getter more robust
authorJouni Malinen <j@w1.fi>
Fri, 24 Jun 2016 20:49:08 +0000 (23:49 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 24 Jun 2016 20:49:08 +0000 (23:49 +0300)
Now that mesh sets wpa_s->wpa_state = WPA_COMPLETED, it looks like this
getter can get called with wpa_s->current_ssid = NULL. That could result
in NULL pointer dereference, so need to protect that specific case.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/dbus/dbus_new_handlers.c

index 27029c5..de6d216 100644 (file)
@@ -3228,9 +3228,11 @@ dbus_bool_t wpas_dbus_getter_current_auth_mode(
                            "EAP-%s", eap_mode);
                auth_mode = eap_mode_buf;
 
-       } else {
+       } else if (wpa_s->current_ssid) {
                auth_mode = wpa_key_mgmt_txt(wpa_s->key_mgmt,
                                             wpa_s->current_ssid->proto);
+       } else {
+               auth_mode = "UNKNOWN";
        }
 
        return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,