summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2023-12-21 14:10:11 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2024-01-03 05:34:40 +0000
commit37539cb0bfe4ed96d4499bf371e6b1a474a740fe (patch)
treed0b23e2df1bb7831483f57afa3fec2a20dc6be6c /Xi
parentf59871587ea678d4c498874895f4b97687764ee1 (diff)
Xi: require a pointer and keyboard device for XIAttachToMaster
If we remove a master device and specify which other master devices attached slaves should be returned to, enforce that those two are indeeed a pointer and a keyboard. Otherwise we can try to attach the keyboards to pointers and vice versa, leading to possible crashes later.
Diffstat (limited to 'Xi')
-rw-r--r--Xi/xichangehierarchy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 504defe56..d2d985848 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -270,7 +270,7 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
if (rc != Success)
goto unwind;
- if (!IsMaster(newptr)) {
+ if (!IsMaster(newptr) || !IsPointerDevice(newptr)) {
client->errorValue = r->return_pointer;
rc = BadDevice;
goto unwind;
@@ -281,7 +281,7 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
if (rc != Success)
goto unwind;
- if (!IsMaster(newkeybd)) {
+ if (!IsMaster(newkeybd) || !IsKeyboardDevice(newkeybd)) {
client->errorValue = r->return_keyboard;
rc = BadDevice;
goto unwind;