mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-03-24 20:40:09 +09:00
channels: add NULL session check in ssh_channel_is_open
Prevent potential NULL pointer dereference when accessing channel->session->alive. Signed-off-by: Manas Trivedi <manas.trivedi.020@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
f060583d6f
commit
34bbb48561
@@ -1738,7 +1738,7 @@ int ssh_channel_write(ssh_channel channel, const void *data, uint32_t len)
|
||||
*/
|
||||
int ssh_channel_is_open(ssh_channel channel)
|
||||
{
|
||||
if (channel == NULL) {
|
||||
if (channel == NULL || channel->session == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return (channel->state == SSH_CHANNEL_STATE_OPEN && channel->session->alive != 0);
|
||||
|
||||
Reference in New Issue
Block a user