From 22b4ac44e4fdbe8f36f2b570cdbdaf237062e33e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 11 Jun 2009 11:08:07 +1000 Subject: [PATCH] Xi: XIGetSelectedEvents mustn't returned masks from non-existing devices. Or devices the client doesn't have XACE permissions for. Signed-off-by: Peter Hutterer --- Xi/xiselectev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index 74e444be6..cafb97641 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -170,6 +170,7 @@ ProcXIGetSelectedEvents(ClientPtr client) OtherInputMasks *masks; InputClientsPtr others = NULL; xXIEventMask *evmask = NULL; + DeviceIntPtr dev; REQUEST(xXIGetSelectedEventsReq); REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq); @@ -211,6 +212,14 @@ ProcXIGetSelectedEvents(ClientPtr client) int j; unsigned char *devmask = others->xi2mask[i]; + if (i > 2) + { + rc = dixLookupDevice(&dev, i, client, DixReadAccess); + if (rc != Success) + continue; + } + + for (j = XI2MASKSIZE - 1; j >= 0; j--) { if (devmask[j] != 0)