From: Martin von Gagern Date: Thu, 25 May 2017 11:59:27 +0000 (+1200) Subject: Bug 3102: FTP directory listing drops fist character of file names X-Git-Tag: SQUID_4_0_20~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9a90bf7eace826ae4db90086a3e706ee2e04485;p=thirdparty%2Fsquid.git Bug 3102: FTP directory listing drops fist character of file names --- diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc index 32ebc16141..a50f2825fe 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -619,10 +619,17 @@ ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags) while (strchr(w_space, *copyFrom)) ++copyFrom; } else { - /* XXX assumes a single space between date and filename + /* Handle the following four formats: + * "MMM DD YYYY Name" + * "MMM DD YYYYName" + * "MMM DD YYYY Name" + * "MMM DD YYYY Name" + * Assuming a single space between date and filename * suggested by: Nathan.Bailey@cc.monash.edu.au and * Mike Battersby */ - copyFrom += strlen(tbuf) + 1; + copyFrom += strlen(tbuf); + if (strchr(w_space, *copyFrom)) + ++copyFrom; } p->name = xstrdup(copyFrom);