diff options
-rw-r--r-- | Xi/exevents.c | 2 | ||||
-rw-r--r-- | dix/devices.c | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 991beca9b..6d85b1be2 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -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; diff --git a/dix/devices.c b/dix/devices.c index ed6e6bdd4..1c702dc49 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -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)); |