[backend/GLFW] Added bounds check (#5621)

* added bounds check

* update from PR feedback
This commit is contained in:
Thomas Anderson 2026-03-04 01:40:15 -06:00 committed by GitHub
parent 28288fafb1
commit de720a8d4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2178,6 +2178,8 @@ static void CursorEnterCallback(GLFWwindow *window, int enter)
// GLFW3: Joystick connected/disconnected callback
static void JoystickCallback(int jid, int event)
{
if (jid < MAX_GAMEPADS)
{
if (event == GLFW_CONNECTED)
{
// 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);
}
}
}
#ifdef _WIN32