diff --git a/pcsx2/MemoryCardFolder.cpp b/pcsx2/MemoryCardFolder.cpp index 5ef1e26141..1305f0699e 100644 --- a/pcsx2/MemoryCardFolder.cpp +++ b/pcsx2/MemoryCardFolder.cpp @@ -1008,7 +1008,9 @@ s32 FolderMemoryCard::Read(u8* dest, u32 adr, int size) FolderMemoryCard::CalculateECC(ecc + (i * 3), &data[i * 0x80]); } - memcpy(dest + eccOffset, ecc, eccLength); + pxAssert(size >= eccOffset); + const u32 copySize = std::min((u32)size - eccOffset, eccLength); + memcpy(dest + eccOffset, ecc, copySize); } SetTimeLastReadToNow();