aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ctrl_iface_udp.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_udp.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_udp.c')
-rw-r--r--wpa_supplicant/ctrl_iface_udp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/wpa_supplicant/ctrl_iface_udp.c b/wpa_supplicant/ctrl_iface_udp.c
index f3b660d..0f53d56 100644
--- a/wpa_supplicant/ctrl_iface_udp.c
+++ b/wpa_supplicant/ctrl_iface_udp.c
@@ -80,14 +80,14 @@ static int wpa_supplicant_ctrl_iface_detach(struct ctrl_iface_priv *priv,
while (dst) {
if (from->sin_addr.s_addr == dst->addr.sin_addr.s_addr &&
from->sin_port == dst->addr.sin_port) {
+ wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor detached "
+ "%s:%d", inet_ntoa(from->sin_addr),
+ ntohs(from->sin_port));
if (prev == NULL)
priv->ctrl_dst = dst->next;
else
prev->next = dst->next;
os_free(dst);
- wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor detached "
- "%s:%d", inet_ntoa(from->sin_addr),
- ntohs(from->sin_port));
return 0;
}
prev = dst;