Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2007-02-04 04:18:41 UTC

Modified files:
     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.833 ircu2.10/ChangeLog:1.834
--- ircu2.10/ChangeLog:1.833    Mon Jan 22 18:40:35 2007
+++ ircu2.10/ChangeLog  Sat Feb  3 20:18:30 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): Warn against using %v in the
+       pattern -- that will cause incorrect behavior.
+       (sendwallto_group): Likewise.
+       (sendcmdto_match): Likewise.
+
 2007-01-22  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (find_delayed_joins): Fix to use sendto_channel()
Index: ircu2.10/ircd/ircd_reply.c
diff -u ircu2.10/ircd/ircd_reply.c:1.23 ircu2.10/ircd/ircd_reply.c:1.24
--- ircu2.10/ircd/ircd_reply.c:1.23     Sun Jul 23 11:04:21 2006
+++ ircu2.10/ircd/ircd_reply.c  Sat Feb  3 20:18:31 2007
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Implementation of functions to send common replies to users.
- * @version $Id: ircd_reply.c,v 1.23 2006/07/23 18:04:21 entrope Exp $
+ * @version $Id: ircd_reply.c,v 1.24 2007/02/04 04:18:31 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(&me, WALL_DESYNCH, NULL,
+  ircd_snprintf(NULL, message, sizeof(message),
                    "Protocol Violation from %s: %v", cli_name(cptr), &vd);
-
   va_end(vd.vd_args);
+
+  sendwallto_group(&me, WALL_DESYNCH, NULL, "%s", message);
   return 0;
 }
 
Index: ircu2.10/ircd/send.c
diff -u ircu2.10/ircd/send.c:1.61 ircu2.10/ircd/send.c:1.62
--- ircu2.10/ircd/send.c:1.61   Thu Jul 27 18:33:52 2006
+++ ircu2.10/ircd/send.c        Sat Feb  3 20:18:31 2007
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Send messages to certain targets.
- * @version $Id: send.c,v 1.61 2006/07/28 01:33:52 entrope Exp $
+ * @version $Id: send.c,v 1.62 2007/02/04 04:18:31 entrope Exp $
  */
 #include "config.h"
 
@@ -527,6 +527,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.
@@ -589,6 +590,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).
@@ -660,6 +662,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