aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus/dbus_old_handlers.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-12-31 14:54:48 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-02 20:50:26 (GMT)
commit3a593ff5b24440dfdfbc0764a748f370956159f5 (patch)
tree266b77bd8b848f92b4a8f4e01f9533dcc9ef639f /wpa_supplicant/dbus/dbus_old_handlers.c
parentf11e797d4c4b26c8551de7b6926d015a16a1206e (diff)
downloadhostap-3a593ff5b24440dfdfbc0764a748f370956159f5.zip
hostap-3a593ff5b24440dfdfbc0764a748f370956159f5.tar.gz
hostap-3a593ff5b24440dfdfbc0764a748f370956159f5.tar.bz2
D-Bus (old): Fix removeNetwork method to not use freed memory
wpa_supplicant_deauthenticate() call needs to happen before wpa_config_remove_network(). Freed memory could be dereferenced if removeNetwork method was issued on the currently connected network. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/dbus/dbus_old_handlers.c')
-rw-r--r--wpa_supplicant/dbus/dbus_old_handlers.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/dbus/dbus_old_handlers.c
index 0f1f5cf..b9c631d 100644
--- a/wpa_supplicant/dbus/dbus_old_handlers.c
+++ b/wpa_supplicant/dbus/dbus_old_handlers.c
@@ -866,6 +866,10 @@ DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
wpas_notify_network_removed(wpa_s, ssid);
+ if (ssid == wpa_s->current_ssid)
+ wpa_supplicant_deauthenticate(wpa_s,
+ WLAN_REASON_DEAUTH_LEAVING);
+
if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
reply = dbus_message_new_error(message,
WPAS_ERROR_REMOVE_NETWORK_ERROR,
@@ -874,9 +878,6 @@ DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
goto out;
}
- if (ssid == wpa_s->current_ssid)
- wpa_supplicant_deauthenticate(wpa_s,
- WLAN_REASON_DEAUTH_LEAVING);
reply = wpas_dbus_new_success_reply(message);
out: