]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix a crash when connection-sharing during userauth.
authorSimon Tatham <anakin@pobox.com>
Mon, 22 Jun 2015 18:37:27 +0000 (19:37 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 22 Jun 2015 18:37:27 +0000 (19:37 +0100)
If a sharing downstream disconnected while we were still in userauth
(probably by deliberate user action, since such a downstream would
have just been sitting there waiting for upstream to be ready for it)
then we could crash by attempting to count234(ssh->channels) before
the ssh->channels tree had been set up in the first place.

A simple null-pointer check fixes it. Thanks to Antti Seppanen for the
report.

ssh.c

diff --git a/ssh.c b/ssh.c
index a41a576c66ec9d25dd18453c7fcf54c9d0291f14..34500821f05e87dc949f0d8684bb8dda482a3ce0 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -7613,7 +7613,7 @@ static void ssh_check_termination(Ssh ssh)
 {
     if (ssh->version == 2 &&
         !conf_get_int(ssh->conf, CONF_ssh_no_shell) &&
-        count234(ssh->channels) == 0 &&
+        (ssh->channels && count234(ssh->channels) == 0) &&
         !(ssh->connshare && share_ndownstreams(ssh->connshare) > 0)) {
         /*
          * We used to send SSH_MSG_DISCONNECT here, because I'd