xserver: Branch 'master'

Peter Hutterer whot at kemper.freedesktop.org
Mon Nov 26 18:49:48 PST 2007


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

New commits:
commit edebe76cfdb31072d18a6fcd3ee8f1d95006855f
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Nov 27 10:22:44 2007 +1030

    Xi: set DeviceXXXState's length fields to the correct size of the struct.
    
    Setting it to the size of a pointer is an interesting but equally wrong
    approach. Luckily Xlib never used this field anyway so nobody got hurt so far.
    
    Spotted by Simon Thum.
    (cherry picked from commit 0f2398d06ce591724e388b3270800c5e22b3de2d)

diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 8a84e91..7175dc2 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -128,7 +128,7 @@ static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
     xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
 
     calib->control = DEVICE_ABS_CALIB;
-    calib->length = sizeof(calib);
+    calib->length = sizeof(xDeviceAbsCalibState);
     calib->min_x = dts->min_x;
     calib->max_x = dts->max_x;
     calib->min_y = dts->min_y;
@@ -159,7 +159,7 @@ static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
     xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
 
     area->control = DEVICE_ABS_AREA;
-    area->length = sizeof(area);
+    area->length = sizeof(xDeviceAbsAreaState);
     area->offset_x = dts->offset_x;
     area->offset_y = dts->offset_y;
     area->width = dts->width;
@@ -185,7 +185,7 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
     xDeviceCoreState *c = (xDeviceCoreState *) buf;
 
     c->control = DEVICE_CORE;
-    c->length = sizeof(c);
+    c->length = sizeof(xDeviceCoreState);
     c->status = dev->coreEvents;
     c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
 
@@ -202,7 +202,7 @@ static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
     xDeviceEnableState *e = (xDeviceEnableState *) buf;
 
     e->control = DEVICE_ENABLE;
-    e->length = sizeof(e);
+    e->length = sizeof(xDeviceEnableState);
     e->enable = dev->enabled;
 
     if (client->swapped) {


More information about the xorg-commit mailing list