From 4e153aed8a943b636135b424e052fc69392ad87c Mon Sep 17 00:00:00 2001 From: Oliver Stöneberg Date: Mon, 16 May 2011 06:45:11 -0700 Subject: channel: Fixed potential use-after-free in ssh_channel_get_exit_status(). If ssh_channel_get_exit_status() is called more than once and the connection closed. --- src/channels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/channels.c b/src/channels.c index d505661..b9ba051 100644 --- a/src/channels.c +++ b/src/channels.c @@ -2616,7 +2616,7 @@ int ssh_channel_get_exit_status(ssh_channel channel) { return -1; } - while (channel->remote_eof == 0 || channel->exit_status == -1) { + while ((channel->remote_eof == 0 || channel->exit_status == -1) && channel->session->alive) { /* Parse every incoming packet */ if (ssh_handle_packets(channel->session,-1) != SSH_OK) { return -1; -- cgit