From b7a9cdd6ee059a27821ae2e193c5881ec4d215da Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 29 Jan 2022 18:22:31 +0000 Subject: [PATCH] term_get_userpass_input: missing NULL check. If term_get_userpass_input is called with term->ldisc not yet set up, then we had a special-case handler that returns an error message - but it does it via the same subroutine that returns normal results, which also turns off the prompt callback in term->ldisc! Need an extra NULL check in that subroutine. Thanks Coverity. --- terminal/terminal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terminal/terminal.c b/terminal/terminal.c index b5d01813..3398cd59 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -7677,7 +7677,8 @@ static inline SeatPromptResult signal_prompts_t(Terminal *term, prompts_t *p, { assert(p->callback && "Asynchronous userpass input requires a callback"); queue_toplevel_callback(p->callback, p->callback_ctx); - ldisc_enable_prompt_callback(term->ldisc, NULL); + if (term->ldisc) + ldisc_enable_prompt_callback(term->ldisc, NULL); p->spr = spr; return spr; }