summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2020-06-03 10:05:51 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-06-03 10:38:40 +0200
commit2782cb0495b7450bd8fe43ce4af886b66fea6c40 (patch)
tree747d277490cbfb4963b46bf6828dd6d70ab340a6
parent533d881b0f4b24c72b35ecc97fa35d295d063e53 (diff)
downloadlibssh-2782cb0495b7450bd8fe43ce4af886b66fea6c40.tar.gz
libssh-2782cb0495b7450bd8fe43ce4af886b66fea6c40.tar.xz
libssh-2782cb0495b7450bd8fe43ce4af886b66fea6c40.zip
sftpserver: Add missing return check for ssh_buffer_add_data()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--src/sftpserver.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/sftpserver.c b/src/sftpserver.c
index b639a2ce..9117f155 100644
--- a/src/sftpserver.c
+++ b/src/sftpserver.c
@@ -73,9 +73,14 @@ sftp_client_message sftp_get_client_message(sftp_session sftp) {
return NULL;
}
- ssh_buffer_add_data(msg->complete_message,
- ssh_buffer_get(payload),
- ssh_buffer_get_len(payload));
+ rc = ssh_buffer_add_data(msg->complete_message,
+ ssh_buffer_get(payload),
+ ssh_buffer_get_len(payload));
+ if (rc < 0) {
+ ssh_set_error_oom(session);
+ sftp_client_message_free(msg);
+ return NULL;
+ }
ssh_buffer_get_u32(payload, &msg->id);