1
1

channels: Don't read from a closed channel

Fixes T76

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Andreas Schneider 2018-09-04 20:33:21 +02:00
родитель 1e195a232a
Коммит e558827c4e

Просмотреть файл

@ -2726,7 +2726,12 @@ int ssh_channel_read_timeout(ssh_channel channel,
if (rc == SSH_ERROR){
return rc;
}
if (session->session_state == SSH_SESSION_STATE_ERROR){
/*
* If the channel is closed or in an error state, reading from it is an error
*/
if (session->session_state == SSH_SESSION_STATE_ERROR ||
channel->state == SSH_CHANNEL_STATE_CLOSED) {
return SSH_ERROR;
}
if (channel->remote_eof && ssh_buffer_get_len(stdbuf) == 0) {