Bug report and fix for FTP.pm

David A. Lee (dave@calldei.com)
Tue, 21 May 1996 09:48:54 -0700 (PDT)


I found the following problem in FTP.pm but email bounced to the owner,
Perhaps this group is interested.

   ----- The following addresses have delivery notifications -----
<Grahm.Barr@tiuk.ti.com>  (unrecoverable error)
...
550 <Grahm.Barr@tiuk.ti.com>... User unknown

   ----- Original message follows -----

I'm using libwww-perl (lwp-request) and I had problems
reading  ftp:// url's.  I tracked  down the problem 
The perl error complained about use of uninitialized string
and substr beyond end of string.

(in version 18 of Net::FTP) to this code :

FTP.pm - line 839

   return $n
    unless($n >= 0);        

The problem is that if sysread() returns 0 then the next line
doing a substr( ... ) fails because the buffer is undefined.
I fixed this by change >= 0 to be >0 like this :

   return $n
    unless($n > 0);        


-David Lee
dave@calldei.com