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 4e153aed8a)
This commit is contained in:
Oliver Stöneberg
2011-05-16 06:45:11 -07:00
committed by Andreas Schneider
parent 629cfbccc4
commit 8154e24027

View File

@@ -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;