1.26.3.0: Apply bounds and error checking for the joystick configuration (fixes #434)

This commit is contained in:
tomcw
2017-07-03 21:48:21 +01:00
parent 63359637ec
commit 1c145ff154
7 changed files with 46 additions and 18 deletions
+13
View File
@@ -817,6 +817,19 @@ void JoySetJoyType(UINT num, DWORD type)
if (num > JN_JOYSTICK1)
return;
if (num == JN_JOYSTICK0) // GH#434
{
_ASSERT(type < J0C_MAX);
if (type >= J0C_MAX)
return;
}
else
{
_ASSERT(type < J1C_MAX);
if (type >= J1C_MAX)
return;
}
joytype[num] = type;
// Refresh centre positions whenever 'joytype' changes