Some broken Microsoft FTP servers seem to be sending the following
response to the FEAT command:
211-FEAT
....SIZE
....MDTM
211 END
A single dot above represents a single space character, so instead of
one space character they send 4 (four) space characters at the beginning
of the internal FEAT lines.
When this happens, the FTP client who sent the FEAT request to Squid
gets nothing; its connection hangs.
The problem is inside FtpHandleFeatReply function while parses the commands
list. Arguments corresponding to an emty string passes to String::substr call
(e->value.substr(beg-raw, end-raw) call) causing failure to a Must clause.
This patch:
- fixes and adds checks to avoid processing lines which does not include a
command.
- try to detect extra spaces before commands
- try to add the same number of spaces before commands inserted by squid
to FEAT commands list (EPSV and EPRT commands)