From: Martin von Gagern Date: Mon, 29 May 2017 04:36:11 +0000 (+1200) Subject: Bug 3102: FTP directory listing drops fist character of file names X-Git-Tag: SQUID_3_5_26~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43b7a454e281b27722ece01763295fb0047dbd46;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 6045cc7d6e..acc52c7fd2 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -626,10 +626,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);