Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2006-07-23 17:31:06 UTC

Modified files:
     ircd/channel.c ChangeLog

Log message:

Do not let ircd.conf make us divide by zero.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.800 ircu2.10/ChangeLog:1.801
--- ircu2.10/ChangeLog:1.800    Sun Jul 23 10:27:34 2006
+++ ircu2.10/ChangeLog  Sun Jul 23 10:30:56 2006
@@ -1,5 +1,10 @@
 2006-07-23  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/channel.c (check_spambot_warning): Avoid division by zero;
+       bug pointed out by comstud.
+
+2006-07-23  Michael Poole <[EMAIL PROTECTED]>
+
        * ircd/s_user.c (get_clean_isupport): Only initialize is_next the
        first time around (otherwise entries get lost).
 
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.171 ircu2.10/ircd/channel.c:1.172
--- ircu2.10/ircd/channel.c:1.171       Mon Jul 17 15:52:11 2006
+++ ircu2.10/ircd/channel.c     Sun Jul 23 10:30:56 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.171 2006/07/17 22:52:11 entrope Exp $
+ * @version $Id: channel.c,v 1.172 2006/07/23 17:30:56 entrope Exp $
  */
 #include "config.h"
 
@@ -3480,8 +3480,15 @@
 check_spambot_warning(struct Client *sptr)
 {
   int decrement_count;
+  int spam_expire_time;
 
-  if (!MyUser(sptr))
+  spam_expire_time = feature_int(FEAT_SPAM_EXPIRE_TIME);
+  if (!spam_expire_time)
+  {
+    /* Admin apparently does not want this feature (we do not want to
+     * divide by zero below). */
+  }
+  else if (!MyUser(sptr))
   {
     /* This client's behavior is someone else's problem. */
   }
@@ -3501,7 +3508,7 @@
     }
   }
   else if ((decrement_count = (CurrentTime - cli_last_part(sptr))
-            / feature_int(FEAT_SPAM_EXPIRE_TIME)) > 0)
+            / spam_expire_time) > 0)
   {
     if (decrement_count > cli_join_part_count(sptr))
       cli_join_part_count(sptr) = 0;
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to