From 58070d221740f21df8c354ab653c49a184d37ebf Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 25 Jun 2005 21:43:09 +0000 Subject: [PATCH] In local-to-remote copies, abort if fxp_init() fails, rather than ploughing on and trying to transfer files, which caused a null-pointer deference. Thanks to Fernando Najera for reporting the bug. git-svn-id: svn://svn.tartarus.org/sgt/putty@6021 cda61777-01e9-0310-a592-d414129be87e --- pscp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pscp.c b/pscp.c index c0bcc60c..19e5df4a 100644 --- a/pscp.c +++ b/pscp.c @@ -749,7 +749,7 @@ static struct fxp_handle *scp_sftp_filehandle; static struct fxp_xfer *scp_sftp_xfer; static uint64 scp_sftp_fileoffset; -void scp_source_setup(char *target, int shouldbedir) +int scp_source_setup(char *target, int shouldbedir) { if (using_sftp) { /* @@ -764,7 +764,7 @@ void scp_source_setup(char *target, int shouldbedir) if (!fxp_init()) { tell_user(stderr, "unable to initialise SFTP: %s", fxp_error()); errs++; - return; + return 1; } sftp_register(req = fxp_stat_send(target)); @@ -787,6 +787,7 @@ void scp_source_setup(char *target, int shouldbedir) } else { (void) response(); } + return 0; } int scp_send_errmsg(char *str) @@ -1978,7 +1979,8 @@ static void toremote(int argc, char *argv[]) do_cmd(host, user, cmd); sfree(cmd); - scp_source_setup(targ, targetshouldbedirectory); + if (scp_source_setup(targ, targetshouldbedirectory)) + return; for (i = 0; i < argc - 1; i++) { src = argv[i]; -- 2.11.0