networking: support ftp PASV responses not ending with ')'

Patch by Baruch Burstein <bmburstein@gmail.com>

function                                             old     new   delta
parse_pasv_epsv                                      153     181     +28

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2020-07-19 20:59:35 +02:00
parent 79a4032eef
commit 06a407c628

View File

@ -38,6 +38,8 @@ int FAST_FUNC parse_pasv_epsv(char *buf)
* Server's IP is N1.N2.N3.N4 (we ignore it) * Server's IP is N1.N2.N3.N4 (we ignore it)
* Server's port for data connection is P1*256+P2 */ * Server's port for data connection is P1*256+P2 */
ptr = strrchr(buf, ')'); ptr = strrchr(buf, ')');
if (!ptr) ptr = strrchr(buf, '\r'); /* for PASV responses not ending with ')' */
if (!ptr) ptr = strrchr(buf, '\n'); /* for PASV responses not ending with ')' */
if (ptr) *ptr = '\0'; if (ptr) *ptr = '\0';
ptr = strrchr(buf, ','); ptr = strrchr(buf, ',');