aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2020-06-03 10:04:09 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-06-03 10:38:34 +0200
commit533d881b0f4b24c72b35ecc97fa35d295d063e53 (patch)
tree6c1a4d1e06499e62985de893f25a1f7e35fadb7d /src
parent866e4442b529e14290db98e3f353caa92c96cc73 (diff)
downloadlibssh-533d881b0f4b24c72b35ecc97fa35d295d063e53.tar.gz
libssh-533d881b0f4b24c72b35ecc97fa35d295d063e53.tar.xz
libssh-533d881b0f4b24c72b35ecc97fa35d295d063e53.zip
sftpserver: Add missing NULL check for ssh_buffer_new()
Thanks to Ramin Farajpour Cami for spotting this. Fixes T232 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/sftpserver.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sftpserver.c b/src/sftpserver.c
index 5a2110e5..b639a2ce 100644
--- a/src/sftpserver.c
+++ b/src/sftpserver.c
@@ -67,6 +67,12 @@ sftp_client_message sftp_get_client_message(sftp_session sftp) {
/* take a copy of the whole packet */
msg->complete_message = ssh_buffer_new();
+ if (msg->complete_message == NULL) {
+ ssh_set_error_oom(session);
+ sftp_client_message_free(msg);
+ return NULL;
+ }
+
ssh_buffer_add_data(msg->complete_message,
ssh_buffer_get(payload),
ssh_buffer_get_len(payload));