mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
xwayland/xwm: add prop count assert in xsurface_set_net_wm_state
This helps mitigate buffer overflows.
This commit is contained in:
parent
cd4827b3b6
commit
13f35139d3
1 changed files with 3 additions and 3 deletions
|
@ -294,10 +294,9 @@ static void xwm_surface_activate(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
|
static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
|
||||||
struct wlr_xwm *xwm = xsurface->xwm;
|
struct wlr_xwm *xwm = xsurface->xwm;
|
||||||
uint32_t property[5];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
i = 0;
|
uint32_t property[5];
|
||||||
|
size_t i = 0;
|
||||||
if (xsurface->modal) {
|
if (xsurface->modal) {
|
||||||
property[i++] = xwm->atoms[NET_WM_STATE_MODAL];
|
property[i++] = xwm->atoms[NET_WM_STATE_MODAL];
|
||||||
}
|
}
|
||||||
|
@ -313,6 +312,7 @@ static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
|
||||||
if (xsurface->minimized) {
|
if (xsurface->minimized) {
|
||||||
property[i++] = xwm->atoms[NET_WM_STATE_HIDDEN];
|
property[i++] = xwm->atoms[NET_WM_STATE_HIDDEN];
|
||||||
}
|
}
|
||||||
|
assert(i <= sizeof(property) / sizeof(property[0]));
|
||||||
|
|
||||||
xcb_change_property(xwm->xcb_conn,
|
xcb_change_property(xwm->xcb_conn,
|
||||||
XCB_PROP_MODE_REPLACE,
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
|
Loading…
Reference in a new issue