Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-05-30 13:15:04 UTC

Modified files:
     ircd/m_endburst.c ChangeLog

Log message:

Fix the dereference of a free()'d struct in m_endburst.c.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.633 ircu2.10/ChangeLog:1.634
--- ircu2.10/ChangeLog:1.633    Mon May 30 06:11:58 2005
+++ ircu2.10/ChangeLog  Mon May 30 06:14:54 2005
@@ -3,6 +3,9 @@
        * ircd/IPcheck.c: Add Debug()s to try to track why the connected
        count underflows.
 
+       * ircd/m_endburst.c (ms_endofburst): Avoid dereferencing 'chan'
+       after it may be freed (in sub1_from_channel).
+
 2005-05-12  Michael Poole <[EMAIL PROTECTED]>
 
        * configure.in: Do not try to outsmart the default CFLAGS.
Index: ircu2.10/ircd/m_endburst.c
diff -u ircu2.10/ircd/m_endburst.c:1.9 ircu2.10/ircd/m_endburst.c:1.10
--- ircu2.10/ircd/m_endburst.c:1.9      Fri Dec 10 21:13:46 2004
+++ ircu2.10/ircd/m_endburst.c  Mon May 30 06:14:53 2005
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_endburst.c,v 1.9 2004/12/11 05:13:46 klmitch Exp $
+ * $Id: m_endburst.c,v 1.10 2005/05/30 13:14:53 entrope Exp $
  */
 
 /*
@@ -126,13 +126,12 @@
   /* Count through channels... */
   for (chan = GlobalChannelList; chan; chan = next_chan) {
     next_chan = chan->next;
-
-    if (!chan->members) { /* empty channel */
-      if ((chan->mode.mode & MODE_BURSTADDED))
-       sub1_from_channel(chan); /* New empty channel, schedule it for removal. 
*/
-    }
-
-    chan->mode.mode &= ~MODE_BURSTADDED;
+    if (!chan->members && (chan->mode.mode & MODE_BURSTADDED)) {
+      /* Newly empty channel, schedule it for removal. */
+      chan->mode.mode &= ~MODE_BURSTADDED;
+      sub1_from_channel(chan);
+   } else
+      chan->mode.mode &= ~MODE_BURSTADDED;
   }
 
   return 0;
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to