Fixed a use-after-free and a memory leak.

This commit is contained in:
2020-08-26 00:09:31 +02:00
parent 260331715f
commit 16c11dada0
3 changed files with 6 additions and 6 deletions

View File

@@ -200,7 +200,7 @@ void CNSocket::step() {
if (activelyReading && readBufferIndex - readSize <= 0) {
// decrypt readBuffer and copy to CNPacketData
CNSocketEncryption::decryptData(readBuffer, (uint8_t*)(&EKey), readSize);
CNSocketEncryption::decryptData((uint8_t*)&readBuffer, (uint8_t*)(&EKey), readSize);
void* tmpBuf = xmalloc(readSize-sizeof(int32_t));
memcpy(tmpBuf, readBuffer+sizeof(uint32_t), readSize-sizeof(int32_t));