mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 02:43:03 +00:00
Fix out of bounds access in dirty_input code
This commit is contained in:
parent
23b0444afe
commit
becb6dee16
@ -59,8 +59,11 @@ static void input_state_set_last(unsigned port, unsigned device,
|
||||
for (i = 0; i < (unsigned)input_state_list->size; i++)
|
||||
{
|
||||
element = (InputListElement*)input_state_list->data[i];
|
||||
if ( element->port == port
|
||||
&& element->device == device && element->index == index)
|
||||
if ( (element->port == port ) &&
|
||||
(element->device == device) &&
|
||||
(element->index == index) &&
|
||||
(id >= 0 && id < (sizeof(element->state) / sizeof(int16_t)))
|
||||
)
|
||||
{
|
||||
element->state[id] = value;
|
||||
return;
|
||||
@ -91,7 +94,8 @@ static int16_t input_state_get_last(unsigned port,
|
||||
|
||||
if ( (element->port == port) &&
|
||||
(element->device == device) &&
|
||||
(element->index == index)
|
||||
(element->index == index) &&
|
||||
(id >= 0 && id < (sizeof(element->state) / sizeof(int16_t)))
|
||||
)
|
||||
return element->state[id];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user