Commit 1110b71e authored by Chris Clayton's avatar Chris Clayton Committed by Peter Hutterer

kdrive: fix build error on gcc 4.8 for out-of-bounds array access

I'm getting a error building xorg-server- with thelatest snapshot
of gcc-4.8:

input.c:225:43: error: array subscript is above 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: 's avatarChris Clayton <>
Reviewed-by: 's avatarKeith Packard <>
Signed-off-by: 's avatarPeter Hutterer <>
parent 94d4e29a
......@@ -221,7 +221,7 @@ KdUnregisterFd(void *closure, int fd, Bool do_close)
if (do_close)
for (j = i; j < kdNumInputFds; j++)
for (j = i; j < (kdNumInputFds - 1); j++)
kdInputFds[j] = kdInputFds[j + 1];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment