mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
channels: Don't read from a closed channel
Fixes T76 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user