diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2023-12-21 14:10:11 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2024-01-03 05:34:40 +0000 |
commit | 37539cb0bfe4ed96d4499bf371e6b1a474a740fe (patch) | |
tree | d0b23e2df1bb7831483f57afa3fec2a20dc6be6c /Xi | |
parent | f59871587ea678d4c498874895f4b97687764ee1 (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.c | 4 |
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; |