Skip to content

Commit 96b3661

Browse files
committed
Verify relative location before writing during UPS patching (#1035)
1 parent 303c3e7 commit 96b3661

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

memmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3644,7 +3644,7 @@ static bool8 ReadUPSPatch (Stream *r, long, int32 &rom_size)
36443644
uint32 relative = 0;
36453645
while(addr < size - 12) {
36463646
relative += XPSdecode(data, addr, size);
3647-
while(addr < size - 12) {
3647+
while(addr < size - 12 && relative < CMemory::MAX_ROM_SIZE) {
36483648
uint8 x = data[addr++];
36493649
Memory.ROM[relative++] ^= x;
36503650
if(!x) break;

0 commit comments

Comments
 (0)