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

View File

@@ -2616,7 +2616,7 @@ int ssh_channel_get_exit_status(ssh_channel channel) {
return -1; 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 */ /* Parse every incoming packet */
if (ssh_handle_packets(channel->session,-1) != SSH_OK) { if (ssh_handle_packets(channel->session,-1) != SSH_OK) {
return -1; return -1;