xinput: Check for NULL argument in XInputGetState.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2019-09-30 13:04:26 -05:00 committed by Alexandre Julliard
parent b03a4b8902
commit b84a4aa53b
2 changed files with 6 additions and 0 deletions

View File

@ -126,6 +126,9 @@ static void test_get_state(void)
} }
} }
result = pXInputGetState(0, NULL);
ok(result == ERROR_BAD_ARGUMENTS, "XInputGetState returned (%d)\n", result);
result = pXInputGetState(XUSER_MAX_COUNT, &state); result = pXInputGetState(XUSER_MAX_COUNT, &state);
ok(result == ERROR_BAD_ARGUMENTS, "XInputGetState returned (%d)\n", result); ok(result == ERROR_BAD_ARGUMENTS, "XInputGetState returned (%d)\n", result);

View File

@ -88,6 +88,9 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputSetState(DWORD index, XINPUT_VIBRATION* vib
* XInputGetState() in the hook, so we need a wrapper. */ * XInputGetState() in the hook, so we need a wrapper. */
static DWORD xinput_get_state(DWORD index, XINPUT_STATE *state) static DWORD xinput_get_state(DWORD index, XINPUT_STATE *state)
{ {
if (!state)
return ERROR_BAD_ARGUMENTS;
HID_find_gamepads(controllers); HID_find_gamepads(controllers);
if (index >= XUSER_MAX_COUNT) if (index >= XUSER_MAX_COUNT)