Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3 syntax errors with some names #16

Closed
th3-z opened this issue Nov 19, 2017 · 2 comments
Closed

sqlite3 syntax errors with some names #16

th3-z opened this issue Nov 19, 2017 · 2 comments

Comments

@th3-z
Copy link
Owner

th3-z commented Nov 19, 2017

Line 68 of database.py causes a syntax error if the player name contains quotes.

@th3-z th3-z added bug labels Nov 20, 2017
@th3-z
Copy link
Owner Author

th3-z commented Nov 20, 2017

To fix this issue all uses of string.format() in database.py's queries needs to be replaced with a parameterized cur.execute(query, (p1,p2))
good:
self.cur.execute("UPDATE players SET dosh = ? WHERE username = ?",\ (player.total_dosh, player.username))
bad:
self.cur.execute('SELECT (health_lost) FROM players WHERE username="{un}"'.\ format(un=username))

@th3-z
Copy link
Owner Author

th3-z commented Mar 9, 2018

Solved by commit d855d67

@th3-z th3-z closed this as completed Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant