aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-07 22:03:35 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-07 22:03:35 +0200
commitff53664f540517a6e7c634ae9cc804d168a9e9a8 (patch)
tree65fb33ec9b60f84b31af20ded19ef30733e64049
parentb811b89f57ec167612948e688d75015f85b9c8f4 (diff)
downloadlibssh-ff53664f540517a6e7c634ae9cc804d168a9e9a8.tar.gz
libssh-ff53664f540517a6e7c634ae9cc804d168a9e9a8.tar.xz
libssh-ff53664f540517a6e7c634ae9cc804d168a9e9a8.zip
sftp: Fix a possible null pointer dereference in sftp_async_read.
-rw-r--r--src/sftp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sftp.c b/src/sftp.c
index 60afdc2f..835588e2 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -1834,13 +1834,18 @@ int sftp_async_read_begin(sftp_file file, uint32_t len){
/* Wait for an asynchronous read to complete and save the data. */
int sftp_async_read(sftp_file file, void *data, uint32_t size, uint32_t id){
- sftp_session sftp = file->sftp;
+ sftp_session sftp;
sftp_message msg = NULL;
sftp_status_message status;
ssh_string datastring;
int err = SSH_OK;
uint32_t len;
+ if (file == NULL) {
+ return SSH_ERROR;
+ }
+ sftp = file->sftp;
+
if (file->eof) {
return 0;
}