Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Adam <dev@robert-adam.de>2021-04-11 14:24:41 +0300
committerRobert Adam <dev@robert-adam.de>2021-04-11 14:24:41 +0300
commit58fee9705d3b802aa2abb5201a1afaa454cc2caa (patch)
tree1d8649c58e320bfeaada1bb7256f30a1e9ccdf65
parent90190bcb01152a9733a050dd5c7d8922dbb9b365 (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.
-rw-r--r--src/murmur/Server.cpp4
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) {