Avoid improper reuse of a va_list.
authorMichael Poole <mdpoole@troilus.org>
Sun, 4 Feb 2007 04:18:31 +0000 (04:18 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sun, 4 Feb 2007 04:18:31 +0000 (04:18 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1762 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/ircd_reply.c
ircd/send.c

index e7c4ac050c1459375602fe2db685022953ad7f2e..c0f94cf85127b48e2acd8237318ce6ba75616fff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-02-03  Michael Poole <mdpoole@troilus.org>
+
+       * 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 <mdpoole@troilus.org>
 
        * ircd/channel.c (find_delayed_joins): New function.
index d5641bec321049be60129b47ca01d7fc61d69dd1..256d18c5047c92f2ad5521eabca98ecce2f3b6f0 100644 (file)
 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 ec4d69b2a5429c1967d3a512e4ac1524ae778068..728edaa32a216866085c7ced6f8407e8da590389 100644 (file)
@@ -597,6 +597,7 @@ void sendcmdto_channel_servers_butone(struct Client *from, const char *cmd,
 
 /** 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 @@ void sendcmdto_channel_butone(struct Client *from, const char *cmd,
 }
 
 /** 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 @@ void sendwallto_group_butone(struct Client *from, int type, struct Client *one,
 }
 
 /** 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.