aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-07-21 13:15:00 +0200
committerDrew DeVault <sir@cmpwn.com>2020-07-22 13:49:24 -0600
commit13f35139d39f3ec40f1f7a20ae15161ef04f03bd (patch)
tree45587016845764a03e09c03370e7eb90e60aaee7 /xwayland
parentcd4827b3b6f2b8b47562e58c4dc8669a0976c282 (diff)
xwayland/xwm: add prop count assert in xsurface_set_net_wm_state
This helps mitigate buffer overflows.
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/xwm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 50a85985..a34d56a2 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -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) {
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) {
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) {
property[i++] = xwm->atoms[NET_WM_STATE_HIDDEN];
}
+ assert(i <= sizeof(property) / sizeof(property[0]));
xcb_change_property(xwm->xcb_conn,
XCB_PROP_MODE_REPLACE,