bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] wget doesn't handle 5-digit port numbers in EPSV reponses


From: Tim Rühsen
Subject: Re: [Bug-wget] wget doesn't handle 5-digit port numbers in EPSV reponses
Date: Sun, 04 Jan 2015 18:57:23 +0100
User-agent: KMail/4.14.2 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; )

Am Sonntag, 4. Januar 2015, 16:19:01 schrieb Adam Sampson:
> Dear wget authors,
> 
> When using wget --passive-ftp against IPv6 FTP servers, I occasionally
> get the following error:
> 
>   ==> EPSV ....
>   Cannot parse PASV response.
> 
> I finally found an FTP server that consistently had this problem today
> (stunnel.mirt.net), and strace showed that the response in question was:
> 
>   229 Entering Extended Passive Mode (|||49854|).
> 
> This is a perfectly valid response. wget is getting confused because of
> an off-by-one error in the code that parses the port number in ftp_epsv.
> When the port number is 5 digits long, i will be 5 at the end of the
> loop, so the test for an invalid port number length should check for it
> being *greater than* 5.
> 
> Here's the trivial fix:
> 
> * ftp-basic.c (ftp_epsv): Accept 5-digit port numbers in EPSV responses.
> 
> diff -x config.log -x config.status -ru tmp/wget-1.16.1/src/ftp-basic.c
> work/wget-1.16.1/src/ftp-basic.c ---
> tmp/wget-1.16.1/src/ftp-basic.c       2014-12-02 07:49:37.000000000 +0000 +++
> work/wget-1.16.1/src/ftp-basic.c      2015-01-04 16:06:02.281000000 +0000 @@
> -788,7 +788,7 @@
>    for (tport = 0, i = 0; i < 5 && c_isdigit (*s); i++, s++)
>        tport = (*s - '0') + 10 * tport;
> 
> -  if (i >= 5)
> +  if (i > 5)
>      {
>        xfree (respline);
>        return FTPINVPASV;
> 
> Thanks very much (and happy new year!),

Happy New Year, Adam.

The loop condition is i < 5, so when i becomes 5 the loop stops.
So how can i be > 5 here ?

Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]