[rcore] Bounds-check gamepad index in GetGamepadAxisCount() and GetGamepadName()

Both public getters indexed CORE.Input.Gamepad.axisCount[gamepad] / .name[gamepad]
with an unvalidated gamepad argument -- an out-of-bounds read for gamepad < 0 or
gamepad >= MAX_GAMEPADS. Every sibling gamepad accessor (IsGamepadAvailable,
IsGamepadButton*, GetGamepadAxisMovement) already guards the index; add the same
check, returning a safe default (0 / NULL).
This commit is contained in:
Brandon Arrendondo 2026-06-23 20:29:57 -04:00
parent 962bbfc6bf
commit fe17e47a80

View File

@ -3934,6 +3934,8 @@ bool IsGamepadAvailable(int gamepad)
// Get gamepad internal name id
const char *GetGamepadName(int gamepad)
{
if ((gamepad < 0) || (gamepad >= MAX_GAMEPADS)) return NULL;
return CORE.Input.Gamepad.name[gamepad];
}
@ -3999,6 +4001,8 @@ int GetGamepadButtonPressed(void)
// Get gamepad axis count
int GetGamepadAxisCount(int gamepad)
{
if ((gamepad < 0) || (gamepad >= MAX_GAMEPADS)) return 0;
return CORE.Input.Gamepad.axisCount[gamepad];
}