From e04d904b2b41c4932bd0371b2b3752e43b1bdcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Sat, 5 Feb 2022 01:53:48 -0400 Subject: [PATCH] fix(net): prevent gibberish padding on linux client (#5941) --- src/network/room_member.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/room_member.cpp b/src/network/room_member.cpp index d67ea8289c..e29c3ff50e 100644 --- a/src/network/room_member.cpp +++ b/src/network/room_member.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include #include @@ -380,6 +381,7 @@ void RoomMember::RoomMemberImpl::HandleChatPacket(const ENetEvent* event) { packet >> chat_entry.nickname; packet >> chat_entry.username; packet >> chat_entry.message; + chat_entry.message.resize(std::min(chat_entry.message.find('\0'), chat_entry.message.size())); Invoke(chat_entry); }