From 31ff9e0f96ad946326453ccaec99d1ab8254c9bd Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 22 Jun 2015 19:37:27 +0100 Subject: [PATCH] Fix a crash when connection-sharing during userauth. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh.c b/ssh.c index a41a576c..34500821 100644 --- 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 -- 2.45.2