mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-29 20:25:19 +01:00
Encode high codepoints as surrogates to safely transport wchar_t over network
fixes #7643
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user