summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Clayton <chris2553@googlemail.com>2013-09-04 15:42:04 +1000
committerMatt Dew <marcoz@osource.org>2013-09-09 13:47:31 -0600
commitaf1c57152e10cfa55843e6330cffc6a3c8c517d3 (patch)
treea30f72d88f4c63084213c19a08d10764e4eddfc6
parent0e37fefea5e91dfdcd18ffd941daa7d05cc3180d (diff)
kdrive: fix build error on gcc 4.8 for out-of-bounds array access
I'm getting a error building xorg-server-1.14.1.902 with thelatest snapshot of gcc-4.8: input.c:225:43: error: array subscript is above array bounds [-Werror=array-bounds] This is because kdNumInputFds can become equal to KD_MAX_INPUT_FDS in KdRegisterFd(). This means that in KdUnregisterFd(), kdInputFds[j + 1] can be beyond the end of the array. Signed-off-by: Chris Clayton <chris2553@googlemail.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--hw/kdrive/src/kinput.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index b1068bbee..09aae442b 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -221,7 +221,7 @@ KdUnregisterFd(void *closure, int fd, Bool do_close)
if (do_close)
close(kdInputFds[i].fd);
kdNumInputFds--;
- for (j = i; j < kdNumInputFds; j++)
+ for (j = i; j < (kdNumInputFds - 1); j++)
kdInputFds[j] = kdInputFds[j + 1];
break;
}