summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-09-05 14:24:29 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-09-05 14:29:16 +1000
commitd239f831f17ccf5468f5dc6b2f199a9c1f6e35af (patch)
tree2d3895aeb3debdd3fd84df5d50bc8aec2f427b75
parent4d3d761799436e80fbcf0d99797eed35e68c90d2 (diff)
eventcomm: add missing axis labels to avoid array overrun
And warn when we run out of labels. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/eventcomm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index faaa57d..e789f0e 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -843,7 +843,7 @@ event_query_touch(InputInfoPtr pInfo)
if (priv->has_touch) {
int axnum;
- static const char *labels[] = {
+ static const char *labels[ABS_MT_MAX] = {
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR,
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR,
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR,
@@ -855,6 +855,9 @@ event_query_touch(InputInfoPtr pInfo)
AXIS_LABEL_PROP_ABS_MT_BLOB_ID,
AXIS_LABEL_PROP_ABS_MT_TRACKING_ID,
AXIS_LABEL_PROP_ABS_MT_PRESSURE,
+ AXIS_LABEL_PROP_ABS_MT_DISTANCE,
+ AXIS_LABEL_PROP_ABS_MT_TOOL_X,
+ AXIS_LABEL_PROP_ABS_MT_TOOL_Y,
};
priv->max_touches = libevdev_get_num_slots(dev);
@@ -888,7 +891,13 @@ event_query_touch(InputInfoPtr pInfo)
break;
default:
- priv->touch_axes[axnum].label = labels[axis_idx];
+ if (axis_idx >= sizeof(labels)/sizeof(labels[0])) {
+ xf86IDrvMsg(pInfo, X_ERROR,
+ "Axis %d out of label range. This is a bug\n",
+ axis);
+ priv->touch_axes[axnum].label = NULL;
+ } else
+ priv->touch_axes[axnum].label = labels[axis_idx];
priv->touch_axes[axnum].min = libevdev_get_abs_minimum(dev, axis);
priv->touch_axes[axnum].max = libevdev_get_abs_maximum(dev, axis);
/* Kernel provides units/mm, X wants units/m */