mirror of
https://github.com/curl/curl.git
synced 2026-08-14 21:23:41 +03:00
ftp: remove superfluous checking for crlf in user or pwd
... as this is already done much earlier in the URL parser. Also add test case 894 that verifies that pop3 with an encodedd CR in the user name is rejected. Closes #4887
This commit is contained in:
parent
c87730daeb
commit
950b53da0d
3 changed files with 38 additions and 19 deletions
17
lib/ftp.c
17
lib/ftp.c
|
|
@ -253,18 +253,6 @@ static void freedirs(struct ftp_conn *ftpc)
|
|||
Curl_safefree(ftpc->newhost);
|
||||
}
|
||||
|
||||
/* Returns non-zero if the given string contains CR (\r) or LF (\n),
|
||||
which are not allowed within RFC 959 <string>.
|
||||
Note: The input string is in the client's encoding which might
|
||||
not be ASCII, so escape sequences \r & \n must be used instead
|
||||
of hex values 0x0d & 0x0a.
|
||||
*/
|
||||
static bool isBadFtpString(const char *string)
|
||||
{
|
||||
return ((NULL != strchr(string, '\r')) ||
|
||||
(NULL != strchr(string, '\n'))) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* AcceptServerConnect()
|
||||
|
|
@ -4377,11 +4365,6 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
|
|||
*/
|
||||
ftp->user = conn->user;
|
||||
ftp->passwd = conn->passwd;
|
||||
if(isBadFtpString(ftp->user))
|
||||
return CURLE_URL_MALFORMAT;
|
||||
if(isBadFtpString(ftp->passwd))
|
||||
return CURLE_URL_MALFORMAT;
|
||||
|
||||
conn->proto.ftpc.known_filesize = -1; /* unknown size for now */
|
||||
|
||||
return CURLE_OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue