Merge pull request #538 from InvoxiPlayGames/master

Fix SQL injection
This commit is contained in:
barronwaffles 2020-07-11 13:57:16 +12:00 committed by GitHub
commit f70eb21394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,12 +367,12 @@ class GamespyDatabase(object):
Start replacing each field one by one.
TODO: Optimize this so it's done all in one update.
FIXME: Possible security issue due to embedding an unsanitized
string directly into the statement.
TODO: Check if other values than firstname/lastname are set using this
"""
with Transaction(self.conn) as tx:
q = "UPDATE users SET \"%s\" = ? WHERE profileid = ?"
tx.nonquery(q % field[0], (field[1], profileid))
if field[0] in ["firstname", "lastname"]:
with Transaction(self.conn) as tx:
q = "UPDATE users SET \"%s\" = ? WHERE profileid = ?"
tx.nonquery(q % field[0], (field[1], profileid))
# Session functions
# TODO: Cache session keys so we don't have to query the database every