Subject: Re: sftp_read problems with large buffer

Re: sftp_read problems with large buffer

From: Peter Stuge <>
Date: Tue, 4 Aug 2009 17:05:37 +0200

Alexander Lamaison wrote:
> select(4, [3], NULL, NULL, NULL) = 1 (in [3])
> recv(3, "\342\261\354\263\243\250i@\367\375\372ylHm\36\364\300\216J\316\1\241@>\252r\227\10\335\270\372\22"...,
> 16384, MSG_NOSIGNAL) = 1408
> select(4, NULL, NULL, NULL, NULL

Good find. This is a bug. The fd_set must not be empty.

> I was hoping to track down the cause a little better but haven't
> had the time. All I know is it occurred somewhere between commit
> 6409bb53ba2fd937260caf1cb2cdbf40d782180c (post RELEASE 1.1), which
> works, and the current master HEAD, which doesn't. I'll try and
> pin this down a little more later.

You can use git bisect for this:

> Are any changes likely candidates for having caused this?

This is a bug near calls to select(), it looks just like there is a
loop around a select() call which does not properly re-initialize the
fd_sets before the second select() call.

Received on 2009-08-04