OPTi 5x7: Fix out of bounds on register read

This commit is contained in:
RichardG867
2024-08-22 13:16:29 -03:00
parent f9e457f3e8
commit a7cff71892

View File

@@ -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