mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-03-25 02:09:22 +00:00
Protect against zero-sized property values. #19882
X.Org Bug 19882 <http://bugs.freedesktop.org/show_bug.cgi?id=19882> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -243,7 +243,9 @@ EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (val->size == 1)
|
||||
if (val->size == 0)
|
||||
return BadMatch;
|
||||
else if (val->size == 1)
|
||||
{
|
||||
int meta = *((CARD8*)val->data);
|
||||
if (meta > EVDEV_MAXBUTTONS)
|
||||
|
||||
@@ -350,11 +350,13 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
}
|
||||
else if (atom == prop_wheel_button)
|
||||
{
|
||||
int bt = *((CARD8*)val->data);
|
||||
int bt;
|
||||
|
||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
bt = *((CARD8*)val->data);
|
||||
|
||||
if (bt < 0 || bt >= EVDEV_MAXBUTTONS)
|
||||
return BadValue;
|
||||
|
||||
@@ -374,11 +376,13 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
}
|
||||
} else if (atom == prop_wheel_inertia)
|
||||
{
|
||||
int inertia = *((CARD16*)val->data);
|
||||
int inertia;
|
||||
|
||||
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
inertia = *((CARD16*)val->data);
|
||||
|
||||
if (inertia < 0)
|
||||
return BadValue;
|
||||
|
||||
@@ -386,11 +390,13 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
pEvdev->emulateWheel.inertia = inertia;
|
||||
} else if (atom == prop_wheel_timeout)
|
||||
{
|
||||
int timeout = *((CARD16*)val->data);
|
||||
int timeout;
|
||||
|
||||
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
timeout = *((CARD16*)val->data);
|
||||
|
||||
if (timeout < 0)
|
||||
return BadValue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user