desktop/murmur/0003-fix-long-username-query.patch
2010-10-08 21:38:50 +00:00

43 lines
1.6 KiB
Diff

commit 6b33dda344f89e5a039b7d79eb43925040654242
Author: Benjamin Jemlich <pcgod@users.sourceforge.net>
Date: Tue Jun 29 14:49:14 2010 +0200
Don't crash on long usernames
diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp
index f12867a..de307ea 100644
--- a/src/murmur/Messages.cpp
+++ b/src/murmur/Messages.cpp
@@ -1231,6 +1231,9 @@ void Server::msgQueryUsers(ServerUser *uSource, MumbleProto::QueryUsers &msg) {
for (int i=0;i<msg.names_size();++i) {
QString name = u8(msg.names(i));
+ if (!validateUserName(name)) {
+ continue;
+ }
int id = getUserID(name);
if (id >= 0) {
name = getUserName(id);
diff --git a/src/murmur/ServerDB.cpp b/src/murmur/ServerDB.cpp
index 11b6906..7e15def 100644
--- a/src/murmur/ServerDB.cpp
+++ b/src/murmur/ServerDB.cpp
@@ -810,7 +810,7 @@ int Server::authenticate(QString &name, const QString &pw, const QStringList &em
TransactionHolder th;
QSqlQuery &query = *th.qsqQuery;
- SQLPREP("SELECT `user_id`,`name`,`pw` FROM `%1users` WHERE `server_id` = ? AND `name` like ?");
+ SQLPREP("SELECT `user_id`,`name`,`pw` FROM `%1users` WHERE `server_id` = ? AND LOWER(`name`) = LOWER(?)");
query.addBindValue(iServerNum);
query.addBindValue(name);
SQLEXEC();
@@ -1051,7 +1051,7 @@ int Server::getUserID(const QString &name) {
TransactionHolder th;
QSqlQuery &query = *th.qsqQuery;
- SQLPREP("SELECT `user_id` FROM `%1users` WHERE `server_id` = ? AND `name` like ?");
+ SQLPREP("SELECT `user_id` FROM `%1users` WHERE `server_id` = ? AND LOWER(`name`) = LOWER(?)");
query.addBindValue(iServerNum);
query.addBindValue(name);
SQLEXEC();