summaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-02-08 16:21:31 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-02-08 22:44:37 +0100
commit0c51036eb6ddef50a1730bdd33a4388b35343125 (patch)
treefd8d67514c053d64acd9d1948450129c9ef1e9fe /lib/ftp.c
parentd836d362ec4c1d467ef5df370ae2573cbd1bfd2b (diff)
downloadcurl-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 8de959c40..c888b7858 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -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);