mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 15:32:59 +00:00
Merge pull request #11379 from jdgleaver/keyboard-mapping-fix
Prevent out of bounds array acces when using left/right to remap 'Keyboard' device type inputs
This commit is contained in:
commit
eab0098216
@ -183,7 +183,7 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[user_idx][btn_idx];
|
||||
|
||||
for (key_id = 0; key_id < RARCH_MAX_KEYS - 1; key_id++)
|
||||
for (key_id = 0; key_id < RARCH_MAX_KEYS; key_id++)
|
||||
{
|
||||
if (remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
@ -192,7 +192,7 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
|
||||
if (key_id > 0)
|
||||
key_id--;
|
||||
else
|
||||
key_id = (RARCH_MAX_KEYS - 1) + MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
key_id = RARCH_MAX_KEYS - 1;
|
||||
|
||||
settings->uints.input_keymapper_ids[user_idx][btn_idx] = key_descriptors[key_id].key;
|
||||
|
||||
|
@ -154,13 +154,13 @@ static int action_right_input_desc_kbd(unsigned type, const char *label,
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[user_idx][btn_idx];
|
||||
|
||||
for (key_id = 0; key_id < RARCH_MAX_KEYS - 1; key_id++)
|
||||
for (key_id = 0; key_id < RARCH_MAX_KEYS; key_id++)
|
||||
{
|
||||
if (remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
}
|
||||
|
||||
if (key_id < (RARCH_MAX_KEYS - 1) + MENU_SETTINGS_INPUT_DESC_KBD_BEGIN)
|
||||
if (key_id < (RARCH_MAX_KEYS - 1))
|
||||
key_id++;
|
||||
else
|
||||
key_id = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user