Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2006-03-25 03:47:07 UTC

Modified files:
  Tag: u2_10_12_branch
     ChangeLog ircd/ircd_signal.c ircd/jupe.c ircd/list.c
     ircd/whowas.c

Log message:

Resolve bug #1457429.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.83 ircu2.10/ChangeLog:1.710.2.84
--- ircu2.10/ChangeLog:1.710.2.83       Thu Mar 23 16:29:55 2006
+++ ircu2.10/ChangeLog  Fri Mar 24 19:46:56 2006
@@ -1,3 +1,16 @@
+2006-03-24  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/ircd_signal.c (alloc_crec): Zero-fill returned
+       ChildRecord structs.
+
+       * ircd/jupe.c (make_jupe): Zero-fill newly allocated jupes.
+
+       * ircd/list.c (make_link): Zero-fill returned SLink structs.
+
+       * ircd/whowas.c (whowas_init): Delete function.
+       (whowas_alloc): Rewrite to follow the more common pattern and to
+       zero-fill returned Whowas structs.
+
 2006-03-23  Kevin L. Mitchell  <[EMAIL PROTECTED]>
 
        * ircd/s_auth.c: rewrite iauth_read(), spliting out the parsing
Index: ircu2.10/ircd/ircd_signal.c
diff -u ircu2.10/ircd/ircd_signal.c:1.6.2.1 ircu2.10/ircd/ircd_signal.c:1.6.2.2
--- ircu2.10/ircd/ircd_signal.c:1.6.2.1 Wed Feb 15 19:27:41 2006
+++ ircu2.10/ircd/ircd_signal.c Fri Mar 24 19:46:56 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Signal handlers for ircu.
- * @version $Id: ircd_signal.c,v 1.6.2.1 2006/02/16 03:27:41 entrope Exp $
+ * @version $Id: ircd_signal.c,v 1.6.2.2 2006/03/25 03:46:56 entrope Exp $
  */
 #include "config.h"
 
@@ -134,6 +134,7 @@
     crec = MyCalloc(1, sizeof(*crec));
   }
 
+  memset(crec, 0, sizeof(*crec));
   crec->next = NULL;
   return crec;
 }
Index: ircu2.10/ircd/jupe.c
diff -u ircu2.10/ircd/jupe.c:1.20 ircu2.10/ircd/jupe.c:1.20.2.1
--- ircu2.10/ircd/jupe.c:1.20   Fri Dec 10 21:13:45 2004
+++ ircu2.10/ircd/jupe.c        Fri Mar 24 19:46:56 2006
@@ -20,7 +20,7 @@
  */
 /** @file
  * @brief Implementation of juped server handling functions.
- * @version $Id: jupe.c,v 1.20 2004/12/11 05:13:45 klmitch Exp $
+ * @version $Id: jupe.c,v 1.20.2.1 2006/03/25 03:46:56 entrope Exp $
  */
 #include "config.h"
 
@@ -65,6 +65,7 @@
   ajupe = (struct Jupe*) MyMalloc(sizeof(struct Jupe)); /* alloc memory */
   assert(0 != ajupe);
 
+  memset(ajupe, 0, sizeof(*ajupe));
   DupString(ajupe->ju_server, server); /* copy vital information */
   DupString(ajupe->ju_reason, reason);
   ajupe->ju_expire = expire;
Index: ircu2.10/ircd/list.c
diff -u ircu2.10/ircd/list.c:1.34.2.1 ircu2.10/ircd/list.c:1.34.2.2
--- ircu2.10/ircd/list.c:1.34.2.1       Wed Feb 15 19:49:54 2006
+++ ircu2.10/ircd/list.c        Fri Mar 24 19:46:56 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Singly and doubly linked list manipulation implementation.
- * @version $Id: list.c,v 1.34.2.1 2006/02/16 03:49:54 entrope Exp $
+ * @version $Id: list.c,v 1.34.2.2 2006/03/25 03:46:56 entrope Exp $
  */
 #include "config.h"
 
@@ -436,6 +436,7 @@
   }
   assert(0 != lp);
   links.inuse++;
+  memset(lp, 0, sizeof(*lp));
   return lp;
 }
 
Index: ircu2.10/ircd/whowas.c
diff -u ircu2.10/ircd/whowas.c:1.17 ircu2.10/ircd/whowas.c:1.17.2.1
--- ircu2.10/ircd/whowas.c:1.17 Sun Mar 20 08:06:30 2005
+++ ircu2.10/ircd/whowas.c      Fri Mar 24 19:46:56 2006
@@ -69,7 +69,7 @@
 
 /** @file
  * @brief Manipulation functions for the whowas list.
- * @version $Id: whowas.c,v 1.17 2005/03/20 16:06:30 entrope Exp $
+ * @version $Id: whowas.c,v 1.17.2.1 2006/03/25 03:46:56 entrope Exp $
  *
  * Since the introduction of numeric nicks (at least for upstream messages,
  * like MODE +o &lt;nick>, KICK #chan &lt;nick>, KILL &lt;nick> etc), there is 
no
@@ -209,18 +209,6 @@
   wwList.ww_alloc--;
 }
 
-/** Initialize a whowas record.
- * @param[in,out] ww Whowas record to initialize.
- * @return The pointer \a ww.
- */
-static struct Whowas *
-whowas_init(struct Whowas *ww)
-{
-  if (ww)
-    memset(ww, 0, sizeof(*ww));
-  return ww;
-}
-
 /** Return a fresh Whowas record.
  * If the total number of records is smaller than determined by
  * FEAT_NICKNAMEHISTORYLENGTH, allocate a new one.  Otherwise,
@@ -230,11 +218,20 @@
 static struct Whowas *
 whowas_alloc(void)
 {
-  if (wwList.ww_alloc >= feature_int(FEAT_NICKNAMEHISTORYLENGTH))
-    return whowas_init(whowas_clean(wwList.ww_tail));
+  struct Whowas *ww;
 
-  wwList.ww_alloc++; /* going to allocate a new one... */
-  return whowas_init((struct Whowas *) MyMalloc(sizeof(struct Whowas)));
+  if (wwList.ww_alloc >= feature_int(FEAT_NICKNAMEHISTORYLENGTH)) {
+    /* reclaim the oldest whowas entry */
+    ww = whowas_clean(wwList.ww_tail);
+  } else {
+    /* allocate a new one */
+    wwList.ww_alloc++;
+    ww = (struct Whowas *) MyMalloc(sizeof(struct Whowas));
+  }
+
+  assert(ww != NULL);
+  memset(ww, 0, sizeof(*ww));
+  return ww;
 }
 
 /** If necessary, trim the whowas list.
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to