Fix loop check in FTP code

Reported-by: Coverity scanner
This commit is contained in:
Tim Rühsen 2014-11-19 14:35:40 +01:00
parent c6ee033425
commit 18fe274e1c
2 changed files with 12 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2014-11-19 Tim Ruehsen <tim.ruehsen@gmx.de>
* ftp-basic.c (ftp_epsv): Fix loop check
Reported-by: Coverity scanner
2014-11-19 Darshit Shah <darnir@gmail.com>
* exits.c (get_status_for_err): GATEWAYTIMEOUT is a Server Error and Wget's

View File

@ -784,15 +784,13 @@ ftp_epsv (int csock, ip_address *ip, int *port)
}
/* Finally, get the port number */
tport = 0;
for (i = 1; c_isdigit (*s); s++)
{
if (i > 5)
{
xfree (respline);
return FTPINVPASV;
}
for (tport = 0, i = 0; i < 5 && c_isdigit (*s); i++, s++)
tport = (*s - '0') + 10 * tport;
if (i >= 5)
{
xfree (respline);
return FTPINVPASV;
}
/* Make sure that the response terminates correcty */