summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorChris Clayton <chris2553@googlemail.com>2013-09-04 15:42:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-09-06 07:04:17 +1000
commit1110b71e360195aab040d835b54540ab558638c5 (patch)
tree8cf29318cc052401a7c0b3e2978976f8a1d455ea /hw
parent94d4e29aedc69431fa9b299ca1b67947173d7a24 (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>
Diffstat (limited to 'hw')
-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 f93830eb1..527c7a2ef 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;
}