diff options
author | Robert Adam <dev@robert-adam.de> | 2021-04-11 14:24:41 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-04-11 14:24:41 +0300 |
commit | 58fee9705d3b802aa2abb5201a1afaa454cc2caa (patch) | |
tree | 1d8649c58e320bfeaada1bb7256f30a1e9ccdf65 /src/murmur/Server.cpp | |
parent | 90190bcb01152a9733a050dd5c7d8922dbb9b365 (diff) |
CHANGE(server): Untrimmed usernames considered invalid
When checking whether a given username is valid, it being trimmed is now
also a criterion. All names with leading and/or trailing whitespace will
be considered invalid from now on.
Diffstat (limited to 'src/murmur/Server.cpp')
-rw-r--r-- | src/murmur/Server.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 2e71fd798..05790548d 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -2092,7 +2092,9 @@ QString Server::addressToString(const QHostAddress &adr, unsigned short port) { } bool Server::validateUserName(const QString &name) { - return (qrUserName.exactMatch(name) && (name.length() <= 512)); + // We expect the name passed to this function to be fully trimmed already. This way we + // prevent "empty" names (at least with the default username restriction). + return (name.trimmed().length() == name.length() && qrUserName.exactMatch(name) && (name.length() <= 512)); } bool Server::validateChannelName(const QString &name) { |