Core: Add range checks to some helpers and similar.

This commit is contained in:
Unknown W. Brackets
2023-01-08 14:10:16 -08:00
parent e9ce0d0b5e
commit dea9cac16c
10 changed files with 32 additions and 27 deletions

View File

@@ -1263,7 +1263,7 @@ void notifyMatchingHandler(SceNetAdhocMatchingContext * context, ThreadMessage *
MatchingArgs argsNew = { 0 };
u32_le dataBufLen = msg->optlen + 8; //max(bufLen, msg->optlen + 8);
u32_le dataBufAddr = userMemory.Alloc(dataBufLen); // We will free this memory after returning from mipscall. FIXME: Are these buffers supposed to be taken/pre-allocated from the memory pool during sceNetAdhocMatchingInit?
uint8_t * dataPtr = Memory::GetPointerWrite(dataBufAddr);
uint8_t *dataPtr = Memory::GetPointerWriteRange(dataBufAddr, dataBufLen);
if (dataPtr) {
memcpy(dataPtr, &msg->mac, sizeof(msg->mac));
if (msg->optlen > 0)