xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 3 05:37:40 UTC 2024


 Xi/xichangehierarchy.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 37539cb0bfe4ed96d4499bf371e6b1a474a740fe
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Dec 21 14:10:11 2023 +1000

    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.

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;


More information about the xorg-commit mailing list