From: Christian Grothoff Date: Mon, 7 May 2012 08:40:43 +0000 (+0000) Subject: -fix uaf X-Git-Tag: initial-import-from-subversion-38251~13626 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=496bd38ea991a0b130a3d17675ac9c593d7a9b09;p=oweals%2Fgnunet.git -fix uaf --- diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index b81d4d4e1..47f3f8777 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c @@ -280,7 +280,8 @@ static int get_session_delete_it (void *cls, const GNUNET_HashCode * key, void *value) { struct Session *s = value; - struct UNIXMessageWrapper * msgw; + struct UNIXMessageWrapper *msgw; + struct UNIXMessageWrapper *next; struct Plugin *plugin = cls; int removed; GNUNET_assert (plugin != NULL); @@ -290,8 +291,11 @@ get_session_delete_it (void *cls, const GNUNET_HashCode * key, void *value) msgw = plugin->msg_head; removed = GNUNET_NO; - for (msgw = plugin->msg_head; NULL != msgw; msgw = msgw->next) + next = plugin->msg_head; + while (NULL != next) { + msgw = next; + next = msgw->next; if (msgw->session != s) continue; GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);