summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-08-10 11:20:43 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-08-10 11:20:43 +0200
commit5f1b895f27e2b9b4be1d47b337ed86f1d76f6beb (patch)
tree04b5da8c47f4e96dae19ca2d74ec672e29b23377 /src/plugins/irc
parentdfcbb6b0589ca9dd96bad4a55bd208d189769bdd (diff)
downloadweechat-5f1b895f27e2b9b4be1d47b337ed86f1d76f6beb.zip
irc: replace calls to strcpy and strcat with a call to snprintf
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-protocol.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 683f56b4f..aaef6877a 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -2803,6 +2803,7 @@ IRC_PROTOCOL_CALLBACK(001)
{
char *server_command, **commands, **ptr_command, *command2, *slash_command;
char *away_msg, *usermode;
+ int length;
IRC_PROTOCOL_MIN_ARGS(3);
@@ -2878,11 +2879,11 @@ IRC_PROTOCOL_CALLBACK(001)
}
else
{
- slash_command = malloc (1 + strlen(command2) + 1);
+ length = 1 + strlen(command2) + 1;
+ slash_command = malloc (length);
if (slash_command)
{
- strcpy (slash_command, "/");
- strcat (slash_command, command2);
+ snprintf (slash_command, length, "/%s", command2);
weechat_command (server->buffer, slash_command);
free (slash_command);
}