summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emuMB.c11
-rw-r--r--src/emuWheel.c16
2 files changed, 24 insertions, 3 deletions
diff --git a/src/emuMB.c b/src/emuMB.c
index 7dce38a..5de5227 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -391,9 +391,18 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val)
EvdevPtr pEvdev = pInfo->private;
if (atom == prop_mbemu)
+ {
+ if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
+ return BadMatch;
+
pEvdev->emulateMB.enabled = *((BOOL*)val->data);
- else if (atom == prop_mbtimeout)
+ } else if (atom == prop_mbtimeout)
+ {
+ if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
+ return BadMatch;
+
pEvdev->emulateMB.timeout = *((INT16*)val->data);
+ }
return Success;
}
diff --git a/src/emuWheel.c b/src/emuWheel.c
index b0e244f..27dec7c 100644
--- a/src/emuWheel.c
+++ b/src/emuWheel.c
@@ -401,6 +401,9 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val)
if (atom == prop_wheel_emu)
{
+ if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
+ return BadMatch;
+
pEvdev->emulateWheel.enabled = *((BOOL*)val->data);
/* Don't enable with zero inertia, otherwise we may get stuck in an
* infinite loop */
@@ -427,13 +430,16 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val)
{
int bt = *((CARD8*)val->data);
+ if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
+ return BadMatch;
+
if (bt < 0 || bt >= EVDEV_MAXBUTTONS)
return BadValue;
pEvdev->emulateWheel.button = bt;
} else if (atom == prop_wheel_axismap)
{
- if (val->size != 4)
- return BadValue;
+ if (val->format != 8 || val->size != 4 || val->type != XA_INTEGER)
+ return BadMatch;
pEvdev->emulateWheel.X.up_button = *((CARD8*)val->data);
pEvdev->emulateWheel.X.down_button = *(((CARD8*)val->data) + 1);
@@ -443,6 +449,9 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val)
{
int inertia = *((CARD16*)val->data);
+ if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
+ return BadMatch;
+
if (inertia < 0)
return BadValue;
@@ -451,6 +460,9 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val)
{
int timeout = *((CARD16*)val->data);
+ if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
+ return BadMatch;
+
if (timeout < 0)
return BadValue;