aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-22 18:13:53 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-22 18:13:53 +0200
commit2ee6282fdda239d75d68c8c82c24a9de31bcb712 (patch)
treedc3433f24fa6c6ea993865faa7445dbae129cda7
parentae218d0d15e89abb19e95056750488e0bb407260 (diff)
downloadlibssh-2ee6282fdda239d75d68c8c82c24a9de31bcb712.tar.gz
libssh-2ee6282fdda239d75d68c8c82c24a9de31bcb712.tar.xz
libssh-2ee6282fdda239d75d68c8c82c24a9de31bcb712.zip
channels: Fix a possible infinite loop if the connection dropped.
This fixes bug #85.
-rw-r--r--src/channels.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/channels.c b/src/channels.c
index 221ce8e2..ad989d78 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1233,7 +1233,9 @@ int channel_write_common(ssh_channel channel, const void *data,
/* it's a good idea to flush the socket now */
do {
rc = ssh_handle_packets(session, timeout);
- } while(ssh_socket_buffered_write_bytes(session->socket) > 0 && timeout != 0);
+ } while(rc == SSH_OK &&
+ timeout != 0 &&
+ ssh_socket_buffered_write_bytes(session->socket) > 0);
out:
leave_function();
return (int)(origlen - len);