From d5c7fb3f0e8179b49cb44af771d7b51028d143f4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 17 Jan 2015 13:48:26 -0800 Subject: [PATCH] Avoid an out of bounds mem access. --- Core/HLE/sceKernelThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 102f9a1adb..d95b0dd85b 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1500,7 +1500,7 @@ u32 sceKernelReferThreadStatus(u32 threadID, u32 statusPtr) t->nt.nativeSize = THREADINFO_SIZE_AFTER_260; if (wantedSize != 0) - Memory::Memcpy(statusPtr, &t->nt, wantedSize); + Memory::Memcpy(statusPtr, &t->nt, std::min(wantedSize, (u32)sizeof(t->nt))); // TODO: What is this value? Basic tests show 0... if (wantedSize > sizeof(t->nt)) Memory::Memset(statusPtr + sizeof(t->nt), 0, wantedSize - sizeof(t->nt));