Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-02-04 04:16:26 UTC

Modified files:
  Tag: u2_10_12_branch
     ChangeLog ircd/ircd_reply.c ircd/send.c

Log message:

Avoid improper reuse of a va_list.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.145 ircu2.10/ChangeLog:1.710.2.146
--- ircu2.10/ChangeLog:1.710.2.145      Mon Jan 22 18:23:26 2007
+++ ircu2.10/ChangeLog  Sat Feb  3 20:16:16 2007
@@ -1,3 +1,13 @@
+2007-02-03  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/ircd_reply.c (protocol_violation): Avoid reusing the
+       va_list in vd.
+
+       * ircd/send.c (sendcmdto_channel_butone): Warn against using %v in
+       the pattern -- that will cause incorrect behavior.
+       (sendwallto_group_butone): Likewise.
+       (sendcmdto_match_butone): Likewise.
+
 2007-01-22  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (find_delayed_joins): New function.
Index: ircu2.10/ircd/ircd_reply.c
diff -u ircu2.10/ircd/ircd_reply.c:1.22 ircu2.10/ircd/ircd_reply.c:1.22.2.1
--- ircu2.10/ircd/ircd_reply.c:1.22     Fri Dec 10 21:13:45 2004
+++ ircu2.10/ircd/ircd_reply.c  Sat Feb  3 20:16:16 2007
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Implementation of functions to send common replies to users.
- * @version $Id: ircd_reply.c,v 1.22 2004/12/11 05:13:45 klmitch Exp $
+ * @version $Id: ircd_reply.c,v 1.22.2.1 2007/02/04 04:16:16 entrope Exp $
  */
 #include "config.h"
 
@@ -50,17 +50,18 @@
 int protocol_violation(struct Client* cptr, const char* pattern, ...)
 {
   struct VarData vd;
+  char message[BUFSIZE];
 
   assert(pattern);
   assert(cptr);
 
   vd.vd_format = pattern;
   va_start(vd.vd_args, pattern);
-
-  sendwallto_group_butone(&me, WALL_DESYNCH, NULL,
-                       "Protocol Violation from %s: %v", cli_name(cptr), &vd);
-
+  ircd_snprintf(NULL, message, sizeof(message),
+                "Protocol Violation from %s: %v", cli_name(cptr), &vd);
   va_end(vd.vd_args);
+
+  sendwallto_group_butone(&me, WALL_DESYNCH, NULL, "%s", message);
   return 0;
 }
 
Index: ircu2.10/ircd/send.c
diff -u ircu2.10/ircd/send.c:1.55 ircu2.10/ircd/send.c:1.55.2.1
--- ircu2.10/ircd/send.c:1.55   Wed Dec 15 19:28:50 2004
+++ ircu2.10/ircd/send.c        Sat Feb  3 20:16:16 2007
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Send messages to certain targets.
- * @version $Id: send.c,v 1.55 2004/12/16 03:28:50 entrope Exp $
+ * @version $Id: send.c,v 1.55.2.1 2007/02/04 04:16:16 entrope Exp $
  */
 #include "config.h"
 
@@ -597,6 +597,7 @@
 
 /** Send a (prefixed) command to all users on this channel, except for
  * \a one and those matching \a skip.
+ * @warning \a pattern must not contain %v.
  * @param[in] from Client originating the command.
  * @param[in] cmd Long name of command.
  * @param[in] tok Short name of command.
@@ -653,6 +654,7 @@
 }
 
 /** Send a (prefixed) WALL of type \a type to all users except \a one.
+ * @warning \a pattern must not contain %v.
  * @param[in] from Source of the command.
  * @param[in] type One of WALL_DESYNCH, WALL_WALLOPS or WALL_WALLUSERS.
  * @param[in] one Client direction to skip (or NULL).
@@ -724,6 +726,7 @@
 }
 
 /** Send a (prefixed) command to all users matching \a to as \a who.
+ * @warning \a pattern must not contain %v.
  * @param[in] from Source of the command.
  * @param[in] cmd Long name of command.
  * @param[in] tok Short name of command.
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to