1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Encode high codepoints as surrogates to safely transport wchar_t over network

fixes #7643
This commit is contained in:
sfan5 2021-01-29 15:24:07 +01:00
parent c834d2ab25
commit 674d67f312
5 changed files with 80 additions and 26 deletions

View file

@ -752,21 +752,8 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
void Server::handleCommand_ChatMessage(NetworkPacket* pkt)
{
/*
u16 command
u16 length
wstring message
*/
u16 len;
*pkt >> len;
std::wstring message;
for (u16 i = 0; i < len; i++) {
u16 tmp_wchar;
*pkt >> tmp_wchar;
message += (wchar_t)tmp_wchar;
}
*pkt >> message;
session_t peer_id = pkt->getPeerId();
RemotePlayer *player = m_env->getPlayer(peer_id);