summaryrefslogtreecommitdiff
authorSimon Thum <simon.thum@gmx.de>2009-09-21 13:23:27 (GMT)
committer Peter Hutterer <peter.hutterer@who-t.net>2009-09-22 06:26:14 (GMT)
commit824a09d856a5f750694e11d2fd2faaa3de705eaa (patch) (side-by-side diff)
treee24bb0bd78f19ed2958b4962dd09c2241f055803
parent9edb9e9b4dde6f73dc5241d078425a7a70699ec9 (diff)
downloadxserver-824a09d856a5f750694e11d2fd2faaa3de705eaa.zip
xserver-824a09d856a5f750694e11d2fd2faaa3de705eaa.tar.gz
dix: move bounds check before access
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--dix/getevents.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 7ddf88b..5224d31 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -578,12 +578,13 @@ GetMaximumEventsNum(void) {
static void
clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
- AxisInfoPtr axis = pDev->valuator->axes + axisNum;
- /* InitValuatoraAxisStruct ensures that (min < max). */
+ AxisInfoPtr axis;
if (axisNum >= pDev->valuator->numAxes)
return;
+ axis = pDev->valuator->axes + axisNum;
+
/* If a value range is defined, clip. If not, do nothing */
if (axis->max_value <= axis->min_value)
return;