From: Ken Thomases Subject: winejoystick: Fix a crash on accessing a CFArray past its end due to an off-by-one error in the Mac code. Message-Id: <77D0B001-E125-4441-8EB2-BE59C33C0093@codeweavers.com> Date: Wed, 18 Mar 2015 14:02:13 -0500 --- dlls/winejoystick.drv/joystick_osx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winejoystick.drv/joystick_osx.c b/dlls/winejoystick.drv/joystick_osx.c index c8850af..cb66c47 100644 --- a/dlls/winejoystick.drv/joystick_osx.c +++ b/dlls/winejoystick.drv/joystick_osx.c @@ -528,7 +528,7 @@ static BOOL open_joystick(joystick_t* joystick) } index = joystick - joysticks; - if (index > CFArrayGetCount(device_main_elements)) + if (index >= CFArrayGetCount(device_main_elements)) return FALSE; joystick->element = (IOHIDElementRef)CFArrayGetValueAtIndex(device_main_elements, index);