From 7bf469dca2e8c620b53616483bacacea724fb685 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 4 Jan 2024 19:03:08 -0800 Subject: [PATCH] (file) Clamp length for stat --- src/devices/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/file.c b/src/devices/file.c index 6385c26..ac628fe 100644 --- a/src/devices/file.c +++ b/src/devices/file.c @@ -270,7 +270,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) case 0x5: addr = (d[0x4] << 8) | d[0x5]; 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; return; case 0x6: