aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Stöneberg <oliverst@online.de>2011-05-16 06:45:11 -0700
committerAndreas Schneider <asn@cryptomilk.org>2011-05-17 20:57:38 +0200
commit8154e240279ac2c54500270eb7d6f39354eb5156 (patch)
tree83322bc075cd77aba29cccdca9c087a905ffba57
parent629cfbccc44da2a3eda66ec665d2f98ad93be0b6 (diff)
downloadlibssh-8154e240279ac2c54500270eb7d6f39354eb5156.tar.gz
libssh-8154e240279ac2c54500270eb7d6f39354eb5156.tar.xz
libssh-8154e240279ac2c54500270eb7d6f39354eb5156.zip
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)
-rw-r--r--src/channels.c2
1 files changed, 1 insertions, 1 deletions
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;