-fix uaf
authorChristian Grothoff <christian@grothoff.org>
Mon, 7 May 2012 08:40:43 +0000 (08:40 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 7 May 2012 08:40:43 +0000 (08:40 +0000)
src/transport/plugin_transport_unix.c

index b81d4d4e1d6ea5db0374f7e2aa47adcdf025b782..47f3f87778b8eda17b8e84512f61f4d2fae2657b 100644 (file)
@@ -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);