xwayland: add a size-safe wrapper for xcb_send_event

xcb_send_event expects the caller to always provide 32 byte data, even if the actual event struct is
smaller than that.

Reference: https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/18
This commit is contained in:
Ilia Bozhinov 2024-04-20 14:59:40 +02:00
parent cc10a5259d
commit c63275d75e
4 changed files with 35 additions and 8 deletions

View file

@ -27,11 +27,12 @@ static void xwm_selection_send_notify(struct wlr_xwm *xwm,
" requestor=%" PRIu32 " selection=%" PRIu32 " target=%" PRIu32 " property=%" PRIu32,
req->requestor, req->time, req->requestor, req->selection, req->target,
selection_notify.property);
xcb_send_event(xwm->xcb_conn,
xwm_send_event_with_size(xwm->xcb_conn,
0, // propagate
req->requestor,
XCB_EVENT_MASK_NO_EVENT,
(const char *)&selection_notify);
&selection_notify,
sizeof(selection_notify));
xcb_flush(xwm->xcb_conn);
}