1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

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,16 +784,14 @@ 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)
for (tport = 0, i = 0; i < 5 && c_isdigit (*s); i++, s++)
tport = (*s - '0') + 10 * tport;
if (i >= 5)
{
xfree (respline);
return FTPINVPASV;
}
tport = (*s - '0') + 10 * tport;
}
/* Make sure that the response terminates correcty */
if (*s++ != delim)