mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-05-25 21:37:54 -04:00
xwayland/xwm: check object type in xwm_handle_surface_id_message()
wlr_surface_from_resource() asserts that the object is a wl_surface. Since arbitrary clients can send such messages, avoid aborting on invalid input. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/work_items/4093
This commit is contained in:
parent
8154d80a4d
commit
c6e2af1155
1 changed files with 7 additions and 0 deletions
|
|
@ -1480,6 +1480,13 @@ static void xwm_handle_surface_id_message(struct wlr_xwm *xwm,
|
||||||
struct wl_resource *resource =
|
struct wl_resource *resource =
|
||||||
wl_client_get_object(xwm->xwayland->server->client, id);
|
wl_client_get_object(xwm->xwayland->server->client, id);
|
||||||
if (resource) {
|
if (resource) {
|
||||||
|
if (wl_resource_get_interface(resource) != &wl_surface_interface) {
|
||||||
|
wlr_log(WLR_DEBUG, "Received client message WL_SURFACE_ID "
|
||||||
|
"for X11 window %u but Wayland object is not a wl_surface",
|
||||||
|
ev->window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_surface *surface = wlr_surface_from_resource(resource);
|
struct wlr_surface *surface = wlr_surface_from_resource(resource);
|
||||||
xwayland_surface_associate(xwm, xsurface, surface);
|
xwayland_surface_associate(xwm, xsurface, surface);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue