lftp-devel  

Re: Memory fault when SFTP transfer interrupted

Alexander V. Lukyanov
Thu, 14 May 2009 01:41:41 -0700

On Wed, May 13, 2009 at 12:51:38PM -0700, Iain Morgan wrote:
> interruption, I sent a SIGTERM to the ssh process or the remote
> sftp-server process. In either case, interrupting the transfer in such a
> manner caused lftp to die with a memory fault.

This patch should fix the problem.

--
   Alexander.
Index: SFtp.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/SFtp.cc,v
retrieving revision 1.84
diff -u -p -r1.84 SFtp.cc
--- SFtp.cc     7 May 2009 07:54:05 -0000       1.84
+++ SFtp.cc     14 May 2009 08:21:18 -0000
@@ -1005,6 +1005,9 @@ int SFtp::HandleReplies()
    if(state!=CONNECTING_2)
       m|=HandlePty();

+   if(!recv_buf)
+      return MOVED;
+
    int i=0;
    Expect *ooo_scan=ooo_chain;
    while(ooo_scan)