]> git.mdlowis.com Git - proto/labwc.git/commitdiff
action: fix UAF when using prompt during reconfigure
authorJohan Malm <jgm323@gmail.com>
Fri, 26 Sep 2025 19:42:31 +0000 (20:42 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Fri, 26 Sep 2025 20:25:34 +0000 (21:25 +0100)
Reported-by: @jlindgren90
Fixes #3106

include/action.h
src/action.c
src/server.c

index 31ecfb6eba8d45fb1c7dc03ef990d7c651bde138..7692e3832cb8f533a710d9f9088578e849180bfb 100644 (file)
@@ -50,6 +50,7 @@ bool actions_contain_toggle_keybinds(struct wl_list *action_list);
 void actions_run(struct view *activator, struct server *server,
        struct wl_list *actions, struct cursor_context *ctx);
 
+void action_prompts_destroy(void);
 bool action_check_prompt_result(pid_t pid, int exit_code);
 
 void action_free(struct action *action);
index 62ab2b2dfce98a19b81f99b11b3e10acc819266d..9a5623ff60aa72a60b4f4e4201544e7f31742abe 100644 (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)
 {
index 56f091b9c00b05c0c68dbe8b8307dcf278e80371..c39649b82f1aafda6e817296de6872b6010fda80 100644 (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);