diff options
author | marha <marha@users.sourceforge.net> | 2011-12-12 14:26:41 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-12-12 14:26:41 +0100 |
commit | 2b5652fc7742c5ac57aca701214b046626a729e9 (patch) | |
tree | a994b9e63a32a7c061bcfb563aa22369c217e49c /xorg-server/Xi/xigrabdev.c | |
parent | 2331d6e4ac699e775ccee07a8a461cae0a98033a (diff) | |
parent | 5efb0a5e19b75137b7294b27f4e7878aeb8f0927 (diff) | |
download | vcxsrv-2b5652fc7742c5ac57aca701214b046626a729e9.tar.gz vcxsrv-2b5652fc7742c5ac57aca701214b046626a729e9.tar.bz2 vcxsrv-2b5652fc7742c5ac57aca701214b046626a729e9.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'xorg-server/Xi/xigrabdev.c')
-rw-r--r-- | xorg-server/Xi/xigrabdev.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/xorg-server/Xi/xigrabdev.c b/xorg-server/Xi/xigrabdev.c index a9b655c0e..1cfbf243b 100644 --- a/xorg-server/Xi/xigrabdev.c +++ b/xorg-server/Xi/xigrabdev.c @@ -41,6 +41,7 @@ #include "exglobals.h" /* BadDevice */ #include "exevents.h" #include "xigrabdev.h" +#include "inpututils.h" int SProcXIGrabDevice(ClientPtr client) @@ -64,7 +65,7 @@ ProcXIGrabDevice(ClientPtr client) xXIGrabDeviceReply rep; int ret = Success; uint8_t status; - GrabMask mask; + GrabMask mask = { 0 }; int mask_len; REQUEST(xXIGrabDeviceReq); @@ -81,9 +82,13 @@ ProcXIGrabDevice(ClientPtr client) stuff->mask_len * 4) != Success) return BadValue; - mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4); - memset(mask.xi2mask, 0, sizeof(mask.xi2mask)); - memcpy(mask.xi2mask, (char*)&stuff[1], mask_len); + mask.xi2mask = xi2mask_new(); + if (!mask.xi2mask) + return BadAlloc; + + mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4); + /* FIXME: I think the old code was broken here */ + xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char*)&stuff[1], mask_len); ret = GrabDevice(client, dev, stuff->grab_mode, stuff->paired_device_mode, @@ -96,6 +101,8 @@ ProcXIGrabDevice(ClientPtr client) None /* confineTo */, &status); + xi2mask_free(&mask.xi2mask); + if (ret != Success) return ret; |