From 1256c618151e896860ff32b5dc369fd50544cc0b Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Tue, 8 Dec 2009 07:33:05 +0100 Subject: [PATCH] Another transport layer fix for bogus -39 (LIBSSH2_ERROR_BAD_USE) errors Commit 683aa0f6b52fb1014873c961709102b5006372fc made send_existing() send more than just the second part of a packet when the kernel did not accept the full packet, but the function still overlooked the SSH protocol overhead in each packet, often 48 bytes. If only the last few bytes of a packet remained, then the packet would erroneously be considered completely sent, and the next call to write more data in the session would return a -39 error. --- src/transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transport.c b/src/transport.c index cba1bc5..5f2ce37 100644 --- a/src/transport.c +++ b/src/transport.c @@ -626,7 +626,7 @@ send_existing(LIBSSH2_SESSION * session, unsigned char *data, p->osent += rc; /* we sent away this much data */ - return p->osent < data_len ? PACKET_EAGAIN : PACKET_NONE; + return rc < length ? PACKET_EAGAIN : PACKET_NONE; } /*