diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2023-12-21 14:10:11 +1000 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2024-01-11 10:01:29 +0100 |
commit | 8134574102ae5e3184e4b228706e82aa5f785a11 (patch) | |
tree | c031626a8bef5c7d8a6ebc38c6311db0376b61a6 | |
parent | 630da5cb174bc192ccb813c8171c470ca3ba3ca0 (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.
(cherry picked from commit 37539cb0bfe4ed96d4499bf371e6b1a474a740fe)
-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; |