Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2d809218
Commit
2d809218
authored
Apr 13, 2014
by
Ken Thomases
Committed by
Alexandre Julliard
Apr 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Check array indexes to avoid exceeding array bounds.
parent
ab872f2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
joystick_osx.c
dlls/dinput/joystick_osx.c
+3
-5
No files found.
dlls/dinput/joystick_osx.c
View file @
2d809218
...
@@ -186,7 +186,7 @@ static IOHIDDeviceRef get_device_ref(int id)
...
@@ -186,7 +186,7 @@ static IOHIDDeviceRef get_device_ref(int id)
IOHIDElementRef
device_main_element
;
IOHIDElementRef
device_main_element
;
IOHIDDeviceRef
hid_device
;
IOHIDDeviceRef
hid_device
;
if
(
!
device_main_elements
)
if
(
!
device_main_elements
||
id
>=
CFArrayGetCount
(
device_main_elements
)
)
return
0
;
return
0
;
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
id
);
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
id
);
...
@@ -325,8 +325,6 @@ static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_
...
@@ -325,8 +325,6 @@ static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_
CFArrayRef
element_children
=
IOHIDElementGetChildren
(
element
);
CFArrayRef
element_children
=
IOHIDElementGetChildren
(
element
);
cnt
=
CFArrayGetCount
(
element_children
);
cnt
=
CFArrayGetCount
(
element_children
);
if
(
cnt
<
1
)
return
;
/* Either add the element to the array or grab its children */
/* Either add the element to the array or grab its children */
for
(
idx
=
0
;
idx
<
cnt
;
idx
++
)
for
(
idx
=
0
;
idx
<
cnt
;
idx
++
)
...
@@ -454,7 +452,7 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -454,7 +452,7 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
device
->
elements
=
NULL
;
device
->
elements
=
NULL
;
if
(
!
device_main_elements
)
if
(
!
device_main_elements
||
device
->
id
>=
CFArrayGetCount
(
device_main_elements
)
)
return
;
return
;
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
...
@@ -585,7 +583,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -585,7 +583,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
TRACE
(
"polling device %i
\n
"
,
device
->
id
);
TRACE
(
"polling device %i
\n
"
,
device
->
id
);
if
(
!
device_main_elements
)
if
(
!
device_main_elements
||
device
->
id
>=
CFArrayGetCount
(
device_main_elements
)
)
return
;
return
;
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment