channel: fix infinite loop in channel_write_common

BUG: https://red.libssh.org/issues/130

Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jon Simons
2013-11-21 11:40:15 -08:00
committed by Andreas Schneider
parent 06cc94eecf
commit 3d934f3ddc

View File

@@ -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;
}