From 8154e240279ac2c54500270eb7d6f39354eb5156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Mon, 16 May 2011 06:45:11 -0700 Subject: [PATCH] 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. (cherry picked from commit 4e153aed8a943b636135b424e052fc69392ad87c) --- src/channels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/channels.c b/src/channels.c index cf4b468d..1b652e95 100644 --- a/src/channels.c +++ b/src/channels.c @@ -2495,7 +2495,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;