D-Bus: Make the CurrentAuthMode property getter more robust

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>
This commit is contained in:
Jouni Malinen 2016-06-24 23:49:08 +03:00
parent e7d454bb76
commit fc1e2c0d91

View file

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