1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +02:00

irc: replace calls to strcpy and strcat with a call to snprintf

This commit is contained in:
Sébastien Helleu
2019-08-10 11:20:43 +02:00
parent dfcbb6b058
commit 5f1b895f27
+4 -3
View File
@@ -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);
}