mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-06-13 14:32:57 -04:00
xwayland/xwm: check WM_TRANSIENT_FOR length
Without this check, the reply value might be smaller than xcb_window_t and will result in an invalid memory read. Reported-by: Tristan <TristanInSec@gmail.com>
This commit is contained in:
parent
a5691ea7c3
commit
63318d28b1
1 changed files with 6 additions and 2 deletions
|
|
@ -808,8 +808,12 @@ static void read_surface_parent(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xwayland_surface *found_parent = NULL;
|
struct wlr_xwayland_surface *found_parent = NULL;
|
||||||
const xcb_window_t *xid = xcb_get_property_value(reply);
|
if (reply->type != XCB_ATOM_NONE) {
|
||||||
if (reply->type != XCB_ATOM_NONE && xid != NULL) {
|
if (xcb_get_property_value_length(reply) != sizeof(xcb_window_t)) {
|
||||||
|
wlr_log(WLR_DEBUG, "Invalid WM_TRANSIENT_FOR property length");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const xcb_window_t *xid = xcb_get_property_value(reply);
|
||||||
found_parent = lookup_surface(xwm, *xid);
|
found_parent = lookup_surface(xwm, *xid);
|
||||||
if (!has_parent(found_parent, xsurface)) {
|
if (!has_parent(found_parent, xsurface)) {
|
||||||
xsurface->parent = found_parent;
|
xsurface->parent = found_parent;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue