From: Daniel Stenberg Date: Tue, 14 Oct 2025 12:43:46 +0000 (+0200) Subject: lib: stop NULL-checking conn->passwd and ->user X-Git-Tag: rc-8_17_0-2~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62961d6cc57deb9beeba32d0ccdbdeec40eea096;p=thirdparty%2Fcurl.git lib: stop NULL-checking conn->passwd and ->user They always point to a string. The string might be zero length. Closes #19059 --- diff --git a/lib/ftp.c b/lib/ftp.c index 58b34eab6d..fd957a2bb4 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2606,7 +2606,7 @@ static CURLcode ftp_state_user_resp(struct Curl_easy *data, /* 331 Password required for ... (the server requires to send the user's password too) */ result = Curl_pp_sendf(data, &ftpc->pp, "PASS %s", - data->conn->passwd ? data->conn->passwd : ""); + data->conn->passwd); if(!result) ftp_state(data, ftpc, FTP_PASS); } diff --git a/lib/pop3.c b/lib/pop3.c index a0fd881a79..2fd496cb31 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -1057,8 +1057,7 @@ static CURLcode pop3_state_user_resp(struct Curl_easy *data, int pop3code, } else /* Send the PASS command */ - result = Curl_pp_sendf(data, &pop3c->pp, "PASS %s", - conn->passwd ? conn->passwd : ""); + result = Curl_pp_sendf(data, &pop3c->pp, "PASS %s", conn->passwd); if(!result) pop3_state(data, POP3_PASS); diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index dc972dc9e6..f9160944be 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -3335,14 +3335,9 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done) function to make the reuse checks properly be able to check this bit. */ connkeep(conn, "SSH default"); - if(conn->user) - infof(data, "User: '%s'", conn->user); - else - infof(data, "User: NULL"); + infof(data, "User: '%s'", conn->user); #ifdef CURL_LIBSSH2_DEBUG - if(conn->passwd) { - infof(data, "Password: %s", conn->passwd); - } + infof(data, "Password: %s", conn->passwd); sock = conn->sock[FIRSTSOCKET]; #endif /* CURL_LIBSSH2_DEBUG */