diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-02-08 16:21:31 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-02-08 22:44:37 +0100 |
commit | 0c51036eb6ddef50a1730bdd33a4388b35343125 (patch) | |
tree | fd8d67514c053d64acd9d1948450129c9ef1e9fe /lib/ftp.c | |
parent | d836d362ec4c1d467ef5df370ae2573cbd1bfd2b (diff) | |
download | curl-0c51036eb6ddef50a1730bdd33a4388b35343125.tar.gz |
ftp: never set data->set.ftp_append outside setopt
Since the set value then risks getting used like that when the easy
handle is reused by the application.
Also: renamed the struct field from 'ftp_append' to 'remote_append'
since it is also used for SSH protocols.
Closes #6579
Diffstat (limited to 'lib/ftp.c')
-rw-r--r-- | lib/ftp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1578,6 +1578,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data, struct connectdata *conn = data->conn; struct FTP *ftp = data->req.p.ftp; struct ftp_conn *ftpc = &conn->proto.ftpc; + bool append = data->set.remote_append; if((data->state.resume_from && !sizechecked) || ((data->state.resume_from > 0) && sizechecked)) { @@ -1604,7 +1605,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data, } /* enable append */ - data->set.ftp_append = TRUE; + append = TRUE; /* Let's read off the proper amount of bytes from the input. */ if(conn->seek_func) { @@ -1661,8 +1662,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data, /* we've passed, proceed as normal */ } /* resume_from */ - result = Curl_pp_sendf(data, &ftpc->pp, - data->set.ftp_append?"APPE %s":"STOR %s", + result = Curl_pp_sendf(data, &ftpc->pp, append?"APPE %s":"STOR %s", ftpc->file); if(!result) state(data, FTP_STOR); |