aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ctrl_iface_unix.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-08-24 20:31:06 (GMT)
committerJouni Malinen <j@w1.fi>2013-08-24 20:31:06 (GMT)
commita235aca316a8a4729735fecb00f7d7775b38d993 (patch)
tree31839539cf88cef9c7317a7e897a259a2e098643 /wpa_supplicant/ctrl_iface_unix.c
parentd011246f792ac2caebb679ca7ec34408fb2c3eab (diff)
downloadhostap-a235aca316a8a4729735fecb00f7d7775b38d993.zip
hostap-a235aca316a8a4729735fecb00f7d7775b38d993.tar.gz
hostap-a235aca316a8a4729735fecb00f7d7775b38d993.tar.bz2
Fix DETACH command debug prints to avoid use of freed memory
In case a control interface socket is detached because of sendmsg() failing for the socket, function call to detach the socket uses a pointer to the socket information in the structure to be freed. Reorder code to print socket info before freeing the data to avoid use of freed memory in case debug prints are enabled. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/ctrl_iface_unix.c')
-rw-r--r--wpa_supplicant/ctrl_iface_unix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c
index cd26eab..879ab7b 100644
--- a/wpa_supplicant/ctrl_iface_unix.c
+++ b/wpa_supplicant/ctrl_iface_unix.c
@@ -94,12 +94,12 @@ static int wpa_supplicant_ctrl_iface_detach(struct dl_list *ctrl_dst,
os_memcmp(from->sun_path, dst->addr.sun_path,
fromlen - offsetof(struct sockaddr_un, sun_path))
== 0) {
- dl_list_del(&dst->list);
- os_free(dst);
wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor detached",
(u8 *) from->sun_path,
fromlen -
offsetof(struct sockaddr_un, sun_path));
+ dl_list_del(&dst->list);
+ os_free(dst);
return 0;
}
}