From 249e8affce9be87c42baee9571bfb01756159242 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Sun, 4 Feb 2007 04:18:31 +0000 Subject: [PATCH] Avoid improper reuse of a va_list. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1762 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 10 ++++++++++ ircd/ircd_reply.c | 9 +++++---- ircd/send.c | 3 +++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7c4ac0..c0f94cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-02-03 Michael Poole + + * 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 * ircd/channel.c (find_delayed_joins): New function. diff --git a/ircd/ircd_reply.c b/ircd/ircd_reply.c index d5641be..256d18c 100644 --- a/ircd/ircd_reply.c +++ b/ircd/ircd_reply.c @@ -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; } diff --git a/ircd/send.c b/ircd/send.c index ec4d69b..728edaa 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -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. -- 2.20.1