mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-21 04:55:02 -05:00
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. [originally from svn r6021]
This commit is contained in:
parent
36e1650965
commit
d3b993a9c1
8
pscp.c
8
pscp.c
@ -749,7 +749,7 @@ static struct fxp_handle *scp_sftp_filehandle;
|
|||||||
static struct fxp_xfer *scp_sftp_xfer;
|
static struct fxp_xfer *scp_sftp_xfer;
|
||||||
static uint64 scp_sftp_fileoffset;
|
static uint64 scp_sftp_fileoffset;
|
||||||
|
|
||||||
void scp_source_setup(char *target, int shouldbedir)
|
int scp_source_setup(char *target, int shouldbedir)
|
||||||
{
|
{
|
||||||
if (using_sftp) {
|
if (using_sftp) {
|
||||||
/*
|
/*
|
||||||
@ -764,7 +764,7 @@ void scp_source_setup(char *target, int shouldbedir)
|
|||||||
if (!fxp_init()) {
|
if (!fxp_init()) {
|
||||||
tell_user(stderr, "unable to initialise SFTP: %s", fxp_error());
|
tell_user(stderr, "unable to initialise SFTP: %s", fxp_error());
|
||||||
errs++;
|
errs++;
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sftp_register(req = fxp_stat_send(target));
|
sftp_register(req = fxp_stat_send(target));
|
||||||
@ -787,6 +787,7 @@ void scp_source_setup(char *target, int shouldbedir)
|
|||||||
} else {
|
} else {
|
||||||
(void) response();
|
(void) response();
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int scp_send_errmsg(char *str)
|
int scp_send_errmsg(char *str)
|
||||||
@ -1978,7 +1979,8 @@ static void toremote(int argc, char *argv[])
|
|||||||
do_cmd(host, user, cmd);
|
do_cmd(host, user, cmd);
|
||||||
sfree(cmd);
|
sfree(cmd);
|
||||||
|
|
||||||
scp_source_setup(targ, targetshouldbedirectory);
|
if (scp_source_setup(targ, targetshouldbedirectory))
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < argc - 1; i++) {
|
for (i = 0; i < argc - 1; i++) {
|
||||||
src = argv[i];
|
src = argv[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user