diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2018-02-14 19:02:24 +0100 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2018-02-14 19:02:24 +0100 |
commit | 1080bf69f8b9d1b25287fd987266f45602480735 (patch) | |
tree | 24309befe1a2194fb2dc6b42ce77b2fa207ee9be | |
parent | 7d26a6debd6e9808d4a4bf7d39b71ad5f5031f79 (diff) |
xdg_shell: add input validatoin for positioner anchor/gravity
-rw-r--r-- | types/wlr_xdg_shell.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/types/wlr_xdg_shell.c b/types/wlr_xdg_shell.c index 6b2d42ee..985c180a 100644 --- a/types/wlr_xdg_shell.c +++ b/types/wlr_xdg_shell.c @@ -270,7 +270,12 @@ static void xdg_positioner_protocol_set_anchor(struct wl_client *client, struct wlr_xdg_positioner *positioner = wl_resource_get_user_data(resource); - /* post error if anchor > XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT ? */ + if (anchor > XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT) { + wl_resource_post_error(resource, + XDG_POSITIONER_ERROR_INVALID_INPUT, + "invalid anchor value"); + return; + } positioner->anchor = anchor; } @@ -280,7 +285,12 @@ static void xdg_positioner_protocol_set_gravity(struct wl_client *client, struct wlr_xdg_positioner *positioner = wl_resource_get_user_data(resource); - /* post error if gravity > XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT ? */ + if (gravity > XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT) { + wl_resource_post_error(resource, + XDG_POSITIONER_ERROR_INVALID_INPUT, + "invalid gravity value"); + return; + } positioner->gravity = gravity; } |