From 730da3e3c2532a33344fd3f646c9a97ed2caada9 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 29 Aug 2011 21:07:20 +0200 Subject: [PATCH] channels: Fix possible infinite loop in channel_read(). (cherry picked from commit 66188f1af84852b9d9fc09acf26454c4cfacefef) --- src/channels.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/channels.c b/src/channels.c index ca730868..23376ac3 100644 --- a/src/channels.c +++ b/src/channels.c @@ -2350,6 +2350,7 @@ int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count, int is_std ssh_session session = channel->session; ssh_buffer stdbuf = channel->stdout_buffer; uint32_t len; + int rc; enter_function(); @@ -2398,7 +2399,10 @@ int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count, int is_std break; } - ssh_handle_packets(session, -2); + rc = ssh_handle_packets(session, -2); + if (rc != SSH_OK) { + return rc; + } } len = buffer_get_rest_len(stdbuf);