mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-17 20:49:10 -04:00
[backend/GLFW] Added bounds check (#5621)
* added bounds check * update from PR feedback
This commit is contained in:
@ -2178,6 +2178,8 @@ static void CursorEnterCallback(GLFWwindow *window, int enter)
|
|||||||
// GLFW3: Joystick connected/disconnected callback
|
// GLFW3: Joystick connected/disconnected callback
|
||||||
static void JoystickCallback(int jid, int event)
|
static void JoystickCallback(int jid, int event)
|
||||||
{
|
{
|
||||||
|
if (jid < MAX_GAMEPADS)
|
||||||
|
{
|
||||||
if (event == GLFW_CONNECTED)
|
if (event == GLFW_CONNECTED)
|
||||||
{
|
{
|
||||||
// WARNING: If glfwGetJoystickName() is longer than MAX_GAMEPAD_NAME_LENGTH,
|
// WARNING: If glfwGetJoystickName() is longer than MAX_GAMEPAD_NAME_LENGTH,
|
||||||
@ -2189,6 +2191,7 @@ static void JoystickCallback(int jid, int event)
|
|||||||
{
|
{
|
||||||
memset(CORE.Input.Gamepad.name[jid], 0, MAX_GAMEPAD_NAME_LENGTH);
|
memset(CORE.Input.Gamepad.name[jid], 0, MAX_GAMEPAD_NAME_LENGTH);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
Reference in New Issue
Block a user