Partial revert of cc8d5d2: Readd length check

Oversized nicknames can cause bigger issues, so it is desireable to
still block them. .Length counts codepoints, not bytes, which means
that 10 character Japanese nicknames, which are configurable ingame,
should still be allowed.
This commit is contained in:
miniduikboot committed 2022-01-27 18:24:02 +01:00
1 parent cc8d5d2a45
commit 3f374da44b
1 file changed
+8
@@ -90,6 +90,14 @@ namespace Impostor.Server.Net.Manager
return;
}
if (name.Length > 10)
{
using var packet = MessageWriter.Get(MessageType.Reliable);
Message01JoinGameS2C.SerializeError(packet, false, DisconnectReason.Custom, DisconnectMessages.UsernameLength);
await connection.SendAsync(packet);
return;
}
if (string.IsNullOrWhiteSpace(name))
{
using var packet = MessageWriter.Get(MessageType.Reliable);