action: fix UAF when using prompt during reconfigure

Reported-by: @jlindgren90

Fixes #3106
This commit is contained in:
Johan Malm 2025-09-26 20:42:31 +01:00 committed by Johan Malm
parent c9030dcc5b
commit 94c980c6be
3 changed files with 13 additions and 0 deletions

View file

@ -867,6 +867,15 @@ cleanup:
buf_reset(&command);
}
void
action_prompts_destroy(void)
{
struct action_prompt *prompt, *tmp;
wl_list_for_each_safe(prompt, tmp, &prompts, link) {
action_prompt_destroy(prompt);
}
}
bool
action_check_prompt_result(pid_t pid, int exit_code)
{

View file

@ -78,6 +78,9 @@
static void
reload_config_and_theme(struct server *server)
{
/* Avoid UAF when dialog client is used during reconfigure */
action_prompts_destroy();
scaled_buffer_invalidate_sharing();
rcxml_finish();
rcxml_read(rc.config_file);