From: Daniel Stenberg Date: Sat, 20 Sep 2025 21:23:07 +0000 (+0200) Subject: ftp: fix ftp_do_more returning with *completep unset X-Git-Tag: rc-8_17_0-1~299 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9baf82a9b4291a948c908bce3f843c556d67deb;p=thirdparty%2Fcurl.git ftp: fix ftp_do_more returning with *completep unset Specifically, when ftpc->wait_data_conn was true and Curl_conn_connect(...) returned with serv_conned == false the code called ftp_check_ctrl_on_data_wait and returned without setting *completep. Now set it to 0 at function start to avoid this happening again. Reported in Joshua's sarif data Closes #18650 --- diff --git a/lib/ftp.c b/lib/ftp.c index df94ea5e66..13b613bc1e 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -3594,6 +3594,9 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep) if(!ftpc || !ftp) return CURLE_FAILED_INIT; + + *completep = 0; /* default to stay in the state */ + /* if the second connection has been set up, try to connect it fully * to the remote host. This may not complete at this time, for several * reasons: @@ -3612,7 +3615,6 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep) /* this is a EPSV connect failing, try PASV instead */ return ftp_epsv_disable(data, ftpc, conn); } - *completep = (int)complete; return result; } }