dix: don't allow more than MAX_VALUATORS on one device.
Some keyboards (?) advertise more than MAX_VALUATORS axes. Parts of the internal event delivery relies on not having more than MAX_VALUATOR axes, so let's cap it down. If there's real devices that require more than the current 36, I'm sure we can bump this up. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
edb70caf21
commit
74d0fc3aee
|
@ -1119,6 +1119,8 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
|
|||
|
||||
if (!dev || !dev->valuator || minval > maxval)
|
||||
return;
|
||||
if (axnum >= dev->valuator->numAxes)
|
||||
return;
|
||||
|
||||
ax = dev->valuator->axes + axnum;
|
||||
|
||||
|
|
|
@ -1088,6 +1088,14 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
|
|||
if (!dev)
|
||||
return FALSE;
|
||||
|
||||
if (numAxes >= MAX_VALUATORS)
|
||||
{
|
||||
LogMessage(X_WARNING,
|
||||
"Device '%s' has %d axes, only using first %d.\n",
|
||||
dev->name, numAxes, MAX_VALUATORS);
|
||||
numAxes = MAX_VALUATORS;
|
||||
}
|
||||
|
||||
valc = (ValuatorClassPtr)xcalloc(1, sizeof(ValuatorClassRec) +
|
||||
numAxes * sizeof(AxisInfo) +
|
||||
numAxes * sizeof(unsigned int));
|
||||
|
|
Loading…
Reference in New Issue
Block a user