diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2023-02-24 12:55:30 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2023-02-24 14:11:55 +0000 |
commit | 53126bf008a03cc70e3922bdb5741ad01aafaf21 (patch) | |
tree | b3182f27febc1739b12d62ae75ecfb896ddf722e /src/x11 | |
parent | bac7b3f4e6b8721cc16d15fbf55a96b52e1e8aa2 (diff) | |
download | mutter-53126bf008a03cc70e3922bdb5741ad01aafaf21.tar.gz |
x11: Prevent use-after-free if a filter is removed during handling
Keep a pointer to the next element, to protect against filters removing
themselves.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2640
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2868>
Diffstat (limited to 'src/x11')
-rw-r--r-- | src/x11/meta-x11-display.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index bda4c3d87..1bf37d6ca 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -2523,11 +2523,14 @@ meta_x11_display_run_event_funcs (MetaX11Display *x11_display, XEvent *xevent) { MetaX11EventFilter *filter; - GList *l; + GList *next, *l = x11_display->event_funcs; - for (l = x11_display->event_funcs; l; l = l->next) + while (l) { filter = l->data; + next = l->next; + filter->func (x11_display, xevent, filter->user_data); + l = next; } } |