From c545c04102605eee9643f84fa6e2f14d467e2d50 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 10 Apr 2023 16:13:36 +0100 Subject: [PATCH] Fix potential null-pointer dereference in ssh_reconfig. ssh->base_layer is NULL when the connection is still in its early stages, before greetings are exchanged. If the user invokes the Change Settings dialog in this situation, ssh_reconfig would call ssh_ppl_reconfigure() on ssh->base_layer without checking if it was NULL first. (cherry picked from commit d67c13eeb8bf64516aac6c2752eb835e9bc7105a) --- ssh/ssh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ssh/ssh.c b/ssh/ssh.c index dbd6dde6..6944e4c2 100644 --- a/ssh/ssh.c +++ b/ssh/ssh.c @@ -1038,7 +1038,8 @@ static void ssh_reconfig(Backend *be, Conf *conf) if (ssh->pinger) pinger_reconfig(ssh->pinger, ssh->conf, conf); - ssh_ppl_reconfigure(ssh->base_layer, conf); + if (ssh->base_layer) + ssh_ppl_reconfigure(ssh->base_layer, conf); conf_free(ssh->conf); ssh->conf = conf_copy(conf);