1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-11 03:42:35 +03:00

sftpserver: Set OOM only if allocation fails

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
Jakub Jelen
2023-06-28 10:17:25 +02:00
parent ddfc2e08b9
commit 9709a466d7

View File

@@ -73,6 +73,7 @@ sftp_make_client_message(sftp_session sftp, sftp_packet packet)
/* take a copy of the whole packet */
msg->complete_message = ssh_buffer_new();
if (msg->complete_message == NULL) {
ssh_set_error_oom(session);
goto error;
}
@@ -233,14 +234,12 @@ sftp_make_client_message(sftp_session sftp, sftp_packet packet)
default:
ssh_set_error(sftp->session, SSH_FATAL,
"Received unhandled sftp message %d", msg->type);
sftp_client_message_free(msg);
return NULL;
goto error;
}
return msg;
error:
ssh_set_error_oom(session);
sftp_client_message_free(msg);
return NULL;
}