From bda2cc69af0e8b7446b91c05b2eb9c242701fb45 Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Mon, 3 Dec 2018 18:02:33 +0100 Subject: [PATCH] sftp: Add NULL check in sftp_opendir() Signed-off-by: Anderson Toshiyuki Sasaki Reviewed-by: Andreas Schneider --- src/sftp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sftp.c b/src/sftp.c index 72bc40bf..5b73910d 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -958,6 +958,10 @@ sftp_dir sftp_opendir(sftp_session sftp, const char *path) uint32_t id; int rc; + if (sftp == NULL) { + return NULL; + } + payload = ssh_buffer_new(); if (payload == NULL) { ssh_set_error_oom(sftp->session);