From e0aafcaf7d02fc396ec31b6ae28db47c51d5ec0b Mon Sep 17 00:00:00 2001 From: Andrew James Date: Mon, 11 Oct 2021 20:02:45 +1100 Subject: [PATCH] Use correct pointer arithmetic in OnLevelData (#3094) Previously was incrementing the pointer 5 places due to the way pointers to complete objects are handled. see https://en.cppreference.com/w/cpp/language/operator_arithmetic#Additive_operators --- Source/msg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/msg.cpp b/Source/msg.cpp index 1e63e104e..b78fb4b71 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -366,7 +366,7 @@ DWORD OnLevelData(int pnum, const TCmd *pCmd) } assert(message.wOffset == sgdwRecvOffset); - memcpy(&sgRecvBuf[message.wOffset], &message + sizeof(message), message.wBytes); + memcpy(&sgRecvBuf[message.wOffset], &message + 1, message.wBytes); sgdwRecvOffset += message.wBytes; return message.wBytes + sizeof(message); }