X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=apps%2Fsilcd%2Fcommand.c;h=807faee2cf8743ed787d06a14f15ee52bc19eb36;hp=7a4d7aa7e45236952d2371d2f1a0b8776564062b;hb=386c883d8774999c6e74d7c6c37e52e4163a4cb1;hpb=73e02ea64eb9744bde0121ee487f8ce8eb803aa9 diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 7a4d7aa7..807faee2 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -3141,10 +3141,8 @@ static void silc_server_command_join_channel(SilcServer server, if (channel->mode & SILC_CHANNEL_MODE_PASSPHRASE) { /* Get passphrase */ tmp = silc_argument_get_arg_type(cmd->args, 3, &tmp_len); - if (tmp) { - passphrase = silc_calloc(tmp_len, sizeof(*passphrase)); - memcpy(passphrase, tmp, tmp_len); - } + if (tmp) + passphrase = silc_memdup(tmp, tmp_len); if (!passphrase || !channel->passphrase || memcmp(passphrase, channel->passphrase, strlen(channel->passphrase))) { @@ -4109,9 +4107,7 @@ SILC_SERVER_CMD_FUNC(cmode) if (channel->founder_method == SILC_AUTH_PASSWORD) { tmp = silc_auth_get_data(auth, &tmp_len); - channel->founder_passwd = - silc_calloc(tmp_len + 1, sizeof(*channel->founder_passwd)); - memcpy(channel->founder_passwd, tmp, tmp_len); + channel->founder_passwd = silc_memdup(tmp, tmp_len); channel->founder_passwd_len = tmp_len; } else { /* Verify the payload before setting the mode */