From 98f01c2abe4771d76febf8fe70111b2bddfab776 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 23 Oct 2008 09:13:41 +1030 Subject: [PATCH] dix: fix endianess issue in AddInputDevice. #18111 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dev->enabled is a Bool. Bool is two bytes. BOOL on the other hand is a protocol type and always 1 byte. So copy the value into the one-byte type before passing it into XIChangeDeviceProperty. Found by Michel Dänzer. X.Org Bug 18111 --- dix/devices.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dix/devices.c b/dix/devices.c index d386f4113..972edcb38 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -139,6 +139,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) DeviceIntPtr devtmp; int devid; char devind[MAX_DEVICES]; + BOOL enabled; /* Find next available id */ memset(devind, 0, sizeof(char)*MAX_DEVICES); @@ -183,8 +184,9 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) *prev = dev; dev->next = NULL; + enabled = TRUE; XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED), - XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled, + XA_INTEGER, 8, PropModeReplace, 1, &enabled, FALSE); XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE); XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL, NULL);