diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-09-05 14:24:29 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-12-22 08:51:12 +1000 |
commit | fbf8df16694dd60d854f05f1f59a786c3df3529a (patch) | |
tree | baa26cb3d8f136967e92b530c3ace4b613d234f0 | |
parent | 7d958088a354d5a7969448f014f3620b59c7e4da (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>
(cherry picked from commit d239f831f17ccf5468f5dc6b2f199a9c1f6e35af)
Conflicts:
src/eventcomm.c
-rw-r--r-- | src/eventcomm.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index 3b32425..801d19f 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -865,6 +865,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, }; if (mtdev->caps.slot.maximum > 0) @@ -895,8 +898,14 @@ event_query_touch(InputInfoPtr pInfo) case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR: break; - default: - priv->touch_axes[axnum].label = labels[i]; + if (i >= sizeof(labels)/sizeof(labels[0])) { + xf86IDrvMsg(pInfo, X_ERROR, + "Axis %d out of label range. This is a bug\n", + i); + priv->touch_axes[axnum].label = NULL; + } else + priv->touch_axes[axnum].label = labels[i]; + priv->touch_axes[axnum].min = mtdev->caps.abs[i].minimum; priv->touch_axes[axnum].max = mtdev->caps.abs[i].maximum; /* Kernel provides units/mm, X wants units/m */ |