Commit 19908a9a authored by Chen Bill's avatar Chen Bill

use memcpy in DuelMode::JoinGame

parent 893a96ed
...@@ -32,7 +32,9 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { ...@@ -32,7 +32,9 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
NetServer::DisconnectPlayer(dp); NetServer::DisconnectPlayer(dp);
return; return;
} }
CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata; CTOS_JoinGame packet;
std::memcpy(&packet, pdata, sizeof packet);
const auto* pkt = &packet;
if(pkt->version != PRO_VERSION) { if(pkt->version != PRO_VERSION) {
STOC_ErrorMsg scem; STOC_ErrorMsg scem;
scem.msg = ERRMSG_VERERROR; scem.msg = ERRMSG_VERERROR;
......
...@@ -36,7 +36,9 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { ...@@ -36,7 +36,9 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
NetServer::DisconnectPlayer(dp); NetServer::DisconnectPlayer(dp);
return; return;
} }
CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata; CTOS_JoinGame packet;
std::memcpy(&packet, pdata, sizeof packet);
const auto* pkt = &packet;
if(pkt->version != PRO_VERSION) { if(pkt->version != PRO_VERSION) {
STOC_ErrorMsg scem; STOC_ErrorMsg scem;
scem.msg = ERRMSG_VERERROR; scem.msg = ERRMSG_VERERROR;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment