mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
FTP: handle "rubbish" in front of directory name in 257 responses
When doing PWD, there's a 257 response which apparently some servers prefix with a comment before the path instead of after it as is otherwise the norm. Failing to parse this, several otherwise legitimate use cases break. Bug: http://curl.haxx.se/mail/lib-2013-04/0113.html
This commit is contained in:
parent
658ec97055
commit
e0fb2d86c9
10
lib/ftp.c
10
lib/ftp.c
@ -2871,13 +2871,19 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
|||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
/* Reply format is like
|
/* Reply format is like
|
||||||
257<space>"<directory-name>"<space><commentary> and the RFC959
|
257<space>[rubbish]"<directory-name>"<space><commentary> and the
|
||||||
says
|
RFC959 says
|
||||||
|
|
||||||
The directory name can contain any character; embedded
|
The directory name can contain any character; embedded
|
||||||
double-quotes should be escaped by double-quotes (the
|
double-quotes should be escaped by double-quotes (the
|
||||||
"quote-doubling" convention).
|
"quote-doubling" convention).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* scan for the first double-quote for non-standard responses */
|
||||||
|
while(ptr < &data->state.buffer[sizeof(data->state.buffer)]
|
||||||
|
&& *ptr != '\n' && *ptr != '\0' && *ptr != '"')
|
||||||
|
ptr++;
|
||||||
|
|
||||||
if('\"' == *ptr) {
|
if('\"' == *ptr) {
|
||||||
/* it started good */
|
/* it started good */
|
||||||
ptr++;
|
ptr++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user