Ken Thomases : winejoystick: Fix a crash on accessing a CFArray past its end due to an off-by-one error in the Mac code.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 19 09:59:02 CDT 2015


Module: wine
Branch: master
Commit: 77432ac45db59440af1aa75e36c93cd025e4e5fc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=77432ac45db59440af1aa75e36c93cd025e4e5fc

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Mar 18 14:02:13 2015 -0500

winejoystick: Fix a crash on accessing a CFArray past its end due to an off-by-one error in the Mac code.

---

 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);




More information about the wine-cvs mailing list