OPTi 5x7: Fix out of bounds on register read
This commit is contained in:
@@ -158,7 +158,7 @@ opti5x7_read(uint16_t addr, void *priv)
|
||||
{
|
||||
const opti5x7_t *dev = (opti5x7_t *) priv;
|
||||
|
||||
return (addr == 0x24) ? dev->regs[dev->idx] : 0xff;
|
||||
return ((addr == 0x24) && (dev->idx < sizeof(dev->regs))) ? dev->regs[dev->idx] : 0xff;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user