From 5f1b895f27e2b9b4be1d47b337ed86f1d76f6beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 10 Aug 2019 11:20:43 +0200 Subject: [PATCH] irc: replace calls to strcpy and strcat with a call to snprintf --- src/plugins/irc/irc-protocol.c | 7 ++++--- 1 file 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); }