Subject: Re: [libssh2] Question about Reading Remote File using SFTP Subsystem

Re: [libssh2] Question about Reading Remote File using SFTP Subsystem

From: Mononen Jussi <>
Date: Fri, 26 Oct 2007 07:31:35 +0300

>> It seems like this buffer limit is imposed around 40k bytes.
>> Anything below this limit, the remote file can be read using
>> this library successfully.
>> Does anyone know why this happens?


a snippet from RFC4253, The Secure Shell (SSH) Transport Layer Protocol:

6.1. Maximum Packet Length

   All implementations MUST be able to process packets with an
   uncompressed payload length of 32768 bytes or less and a total packet
   size of 35000 bytes or less (including 'packet_length',
   'padding_length', 'payload', 'random padding', and 'mac'). The
   maximum of 35000 bytes is an arbitrarily chosen value that is larger
   than the uncompressed length noted above. Implementations SHOULD
   support longer packets, where they might be needed. For example, if
   an implementation wants to send a very large number of certificates,
   the larger packets MAY be sent if the identification string indicates
   that the other party is able to process them. However,
   implementations SHOULD check that the packet length is reasonable in
   order for the implementation to avoid denial of service and/or buffer
   overflow attacks.

So the server might refuse larger than 40kb packets. This would be my
first guess. You can also use the libssh2 debug mode to see more
detailes about the connection and transfer attempts.



perl -e '$@=[[0,0112,0,0],[0,0101,0,0],
Disclaimer: This message and any attachments thereto are intended solely for
the addressed recipient(s) and may contain confidential information. If you
are not the intended recipient, please notify the sender by reply e-mail and
delete the e-mail (including any attachments thereto) without producing,
distributing or retaining any copies thereof. Any review, dissemination or
other use of, or taking of any action in reliance upon, this information by
persons or entities other than the intended recipient(s) is prohibited.
Thank you.
This email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>
libssh2-devel mailing list
Received on 2007-10-26