diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-07 17:31:30 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-07 17:53:42 +0200 |
commit | 5eaac71d25e62c5fe42cc4b540638b057eed3244 (patch) | |
tree | 2dfb0f7fdbb1bc3ad399e46e850079b18001f996 | |
parent | fd5f42dc062aa689a1fa244dcd45d2cffa0d499a (diff) | |
download | weechat-5eaac71d25e62c5fe42cc4b540638b057eed3244.zip |
relay/api: use function asprintf to build string with salt and password
-rw-r--r-- | src/plugins/relay/api/remote/relay-remote-network.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/plugins/relay/api/remote/relay-remote-network.c b/src/plugins/relay/api/remote/relay-remote-network.c index 79c6561c7..a6b6fbf58 100644 --- a/src/plugins/relay/api/remote/relay-remote-network.c +++ b/src/plugins/relay/api/remote/relay-remote-network.c @@ -611,7 +611,7 @@ relay_remote_network_connect_ws_auth (struct t_relay_remote *remote) char str_http[8192], str_totp[128]; char hash[512 / 8], hash_hexa[((512 / 8) * 2) + 1]; char ws_key[16], ws_key_base64[64]; - int length, hash_size; + int hash_size; time_t time_now; relay_remote_set_status (remote, RELAY_STATUS_AUTHENTICATING); @@ -641,11 +641,8 @@ relay_remote_network_connect_ws_auth (struct t_relay_remote *remote) break; case RELAY_AUTH_PASSWORD_HASH_SHA256: case RELAY_AUTH_PASSWORD_HASH_SHA512: - length = strlen (password) + 64; - salt_password = malloc (length); - if (salt_password) + if (weechat_asprintf (&salt_password, "%ld%s", time_now, password) >= 0) { - snprintf (salt_password, length, "%ld%s", time_now, password); if (weechat_crypto_hash ( salt_password, strlen (salt_password), relay_auth_password_hash_algo_name[remote->password_hash_algo], |