1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-05 01:02:39 +03:00

Add missing return value check

This issue was detected by covscan

Signed-off-by: Norbert Pocs <npocs@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Norbert Pocs
2023-05-02 16:46:29 +02:00
committed by Andreas Schneider
parent 4b5ccd4995
commit 9f8d46a45a
2 changed files with 37 additions and 16 deletions

View File

@@ -445,11 +445,18 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server){
hexa = ssh_get_hexa(output_token.value, output_token.length);
SSH_LOG(SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
SAFE_FREE(hexa);
ssh_buffer_pack(session->out_buffer,
"bdP",
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
output_token.length,
(size_t)output_token.length, output_token.value);
rc = ssh_buffer_pack(session->out_buffer,
"bdP",
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
output_token.length,
(size_t)output_token.length, output_token.value);
if (rc != SSH_OK) {
ssh_set_error_oom(session);
ssh_auth_reply_default(session, 0);
ssh_gssapi_free(session);
session->gssapi = NULL;
return SSH_PACKET_USED;
}
ssh_packet_send(session);
}
@@ -859,6 +866,7 @@ static gss_OID ssh_gssapi_oid_from_string(ssh_string oid_s)
}
SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_response){
int rc;
ssh_string oid_s;
gss_uint32 maj_stat, min_stat;
gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;
@@ -910,11 +918,15 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_response){
hexa = ssh_get_hexa(output_token.value, output_token.length);
SSH_LOG(SSH_LOG_PACKET, "GSSAPI: sending token %s", hexa);
SAFE_FREE(hexa);
ssh_buffer_pack(session->out_buffer,
"bdP",
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
output_token.length,
(size_t)output_token.length, output_token.value);
rc = ssh_buffer_pack(session->out_buffer,
"bdP",
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
output_token.length,
(size_t)output_token.length, output_token.value);
if (rc != SSH_OK) {
ssh_set_error_oom(session);
goto error;
}
ssh_packet_send(session);
session->auth.state = SSH_AUTH_STATE_GSSAPI_TOKEN;
}
@@ -977,6 +989,7 @@ static int ssh_gssapi_send_mic(ssh_session session)
}
SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
int rc;
ssh_string token;
char *hexa;
OM_uint32 maj_stat, min_stat;
@@ -1029,11 +1042,15 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
hexa = ssh_get_hexa(output_token.value, output_token.length);
SSH_LOG(SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
SAFE_FREE(hexa);
ssh_buffer_pack(session->out_buffer,
"bdP",
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
output_token.length,
(size_t)output_token.length, output_token.value);
rc = ssh_buffer_pack(session->out_buffer,
"bdP",
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
output_token.length,
(size_t)output_token.length, output_token.value);
if (rc != SSH_OK) {
ssh_set_error_oom(session);
goto error;
}
ssh_packet_send(session);
}