1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 12:56:37 +02:00

irc: check return code of snprintf

This removes two compiler warnings.
This commit is contained in:
Sébastien Helleu
2023-01-08 18:13:05 +01:00
parent f305eed01f
commit 0bde2aa0f3
+12 -8
View File
@@ -115,7 +115,7 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
char client_signature[512 / 8], client_proof[512 / 8];
char client_proof_base64[((512 / 8) * 4) + 1], server_key[512 / 8];
char server_signature[512 / 8];
int i, length, num_attrs, iterations, salt_size, salted_password_size;
int i, rc, length, num_attrs, iterations, salt_size, salted_password_size;
int client_key_size, stored_key_size, client_signature_size;
int server_key_size, server_signature_size, verifier_size;
long number;
@@ -344,10 +344,12 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
auth_message = malloc (length);
if (!auth_message)
goto memory_error;
snprintf (auth_message, length, "%s,%s,%s",
server->sasl_scram_client_first,
data,
auth_no_proof);
rc = snprintf (auth_message, length, "%s,%s,%s",
server->sasl_scram_client_first,
data,
auth_no_proof);
if ((rc < 0) || (rc >= length))
goto memory_error;
if (server->sasl_scram_auth_message)
free (server->sasl_scram_auth_message);
server->sasl_scram_auth_message = strdup (auth_message);
@@ -374,9 +376,11 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
/* final message: auth_no_proof + "," + proof */
length = strlen (auth_no_proof) + 3 + strlen (client_proof_base64);
string = malloc (length + 1);
snprintf (string, length + 1, "%s,p=%s",
auth_no_proof,
client_proof_base64);
rc = snprintf (string, length + 1, "%s,p=%s",
auth_no_proof,
client_proof_base64);
if ((rc < 0) || (rc >= length + 1))
goto memory_error;
}
}
goto end;