diff --git a/src/network/room.cpp b/src/network/room.cpp
index 90d6d08dc..cd0c0ebc4 100644
--- a/src/network/room.cpp
+++ b/src/network/room.cpp
@@ -912,7 +912,7 @@ void Room::RoomImpl::HandleChatPacket(const ENetEvent* event) {
     }
 
     // Limit the size of chat messages to MaxMessageSize
-    message.resize(MaxMessageSize);
+    message.resize(std::min(static_cast<u32>(message.size()), MaxMessageSize));
 
     Packet out_packet;
     out_packet << static_cast<u8>(IdChatMessage);