[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] channel: fix infinite loop in channel_write_common


Hi,

Attached is a patch which fixes the problem described
here: https://red.libssh.org/issues/130.


Thanks,
-Jon
From 8817336759dca07a9ce754ff04149327e8c3cec9 Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Thu, 21 Nov 2013 11:40:15 -0800
Subject: [PATCH] channel: fix infinite loop in channel_write_common

BUG: https://red.libssh.org/issues/130
---
 src/channels.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/channels.c b/src/channels.c
index 78d9ff7..0a8b9f2 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1329,7 +1329,9 @@ static int channel_write_common(ssh_channel channel,
                 "Wait for a growing window message...");
           rc = ssh_handle_packets_termination(session, SSH_TIMEOUT_DEFAULT,
               ssh_channel_waitwindow_termination,channel);
-          if (rc == SSH_ERROR || !ssh_channel_waitwindow_termination(channel))
+          if (rc == SSH_ERROR ||
+              !ssh_channel_waitwindow_termination(channel) ||
+              channel->session->session_state == SSH_SESSION_STATE_ERROR)
             goto out;
           continue;
       }
-- 
1.8.2


Archive administrator: postmaster@lists.cynapses.org