(file) Clamp length for stat

This commit is contained in:
Devine Lu Linvega 2024-01-04 19:03:08 -08:00
parent 2878639cd7
commit 7bf469dca2
1 changed files with 1 additions and 1 deletions

View File

@ -270,7 +270,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port)
case 0x5: case 0x5:
addr = (d[0x4] << 8) | d[0x5]; addr = (d[0x4] << 8) | d[0x5];
if(rL > 0x10000 - addr) rL = 0x10000 - addr; if(rL > 0x10000 - addr) rL = 0x10000 - addr;
res = file_stat(c, (char *)&ram[addr], rL); res = file_stat(c, (char *)&ram[addr], rL > 0x10 ? 0x10 : rL);
d[0x2] = res >> 8, d[0x3] = res; d[0x2] = res >> 8, d[0x3] = res;
return; return;
case 0x6: case 0x6: