SpunkyBot / spunkybot

Multi-platform administration and RCON tool for Urban Terror
https://spunkybot.de
MIT License
20 stars 24 forks source link

Player with single quote in the name causes an error on the spunkybot console #128

Closed ge0rdie closed 2 years ago

ge0rdie commented 2 years ago

Summary I have a person using bad language on the server, but when I went to find him in the DB, he was not there. Tried searching by name, alias and ip address, nothing.

Error resulted in player not being inserted into the DB.

Steps to reproduce

  1. start with a fresh player profile
  2. set player name to Applejack'Al
  3. connect to the server and watch the spunkybot console

Expected behavior Console shows the following error:

[18.02.2022 06:30:15] ERROR near "Al": syntax error Traceback (most recent call last): File "spunkybot/spunky.py", line 643, in parse_line optionaction File "spunkybot/spunky.py", line 876, in handle_userinfo self.game.add_player(player) File "spunkybot/spunky.py", line 4149, in add_player player.check_database() File "spunkybot/spunky.py", line 3393, in check_database curs.execute("UPDATE player SET name = '{}',ip_address = '{}',time_joined = '{}' WHERE guid = '{}'".format(self.name, self.address, now, self.guid)) OperationalError: near "Al": syntax error

Runtime Environment

Log file / Screenshots / Console output If applicable, add the devel.log file from your Spunky Bot installation folder, add screenshots or console output to help explain your problem.

This is the games.log for the event:

12:14 ClientUserinfo: 7 \ip\110.225.247.195:27960\challenge\750310731\qport\8438\protocol\68\snaps\20\name\Applejack'Al\racered\3\raceblue\3\racefree\3\rate\25000\ut_timenudge\0\cg_rgb\0 255 0\cg_physics\1\cg_ghost\1\cg_autopickup-1\color1\4\color2\5\handicap\100\sex\male\gear\gHAOWVA\authc\0\cl_guid\D6545F0B2016362B7ED4258F4AEB24B0\weapmodes\0000011102000002000200000000 12:14 ClientUserinfoChanged: 7 n\Applejack'Al\t\3\r\3\tl\0\f0\f1\f2\a0\0\a1\255\a2\0 12:15 ClientUserinfo: 7 \ip\110.225.247.195:27960\name\Applejack'Al\challenge\750310731\qport\8438\protocol\68\snaps\20\racered\3\raceblue\3\racefree\3\rate\25000\ut_timenudge\0\cg_rgb\0 255 0\cg_physics\1\cg_ghost\1\cg_autopickup-1\color1\4\color2\5\handicap\100\sex\male\gear\gHAOWVA\authc\0\cl_guid\D6545F0B2016362B7ED4258F4AEB24B0\weapmodes\0000011102000002000200000000 12:15 ClientUserinfoChanged: 7 n\Applejack'Al\t\3\r\3\tl\0\f0\f1\f2\a0\0\a1\255\a2\0 12:30 ClientUserinfo: 7 \ip\110.225.247.195:27960\name\Applejack'Al\challenge\750310731\qport\8438\protocol\68\snaps\20\racered\3\raceblue\3\racefree\3\rate\25000\ut_timenudge\0\cg_rgb\0 255 0\cg_physics\1\cg_ghost\1\cg_autopickup-1\color1\4\color2\5\handicap\100\sex\male\gear\gHAOWVA\authc\0\cl_guid\D6545F0B2016362B7ED4258F4AEB24B0\weapmodes\0000011102000002000200000000 12:30 ClientUserinfoChanged: 7 n\Applejack'Al\t\2\r\3\tl\0\f0\f1\f2\a0\0\a1\255\a2\0 12:59 say: 7 Applejack'Al: fuck islam and fuck all muslims 13:20 say: 7 Applejack'Al: mohammed was a paedo

Additional context Add any other context about the problem here.

thanks --ge0rdie

alexanderkress commented 2 years ago

hmm looks like the preparation for the mysql support create the issue with single quote. need to think about it if it is possible to fix that or if the name needs to be shorten...

alexanderkress commented 2 years ago

I have a fix for this issue in rel. 1.13.1. I need some further tests to check all positions where the name value is used.

ge0rdie commented 2 years ago

Thanks mate, much appreciated

--ge0rdie

On Wed, Feb 23, 2022 at 9:37 AM Alexander Kress @.***> wrote:

I have a fix for this issue in rel. 1.13.1. I need some further tests to check all positions where the name value is used.

— Reply to this email directly, view it on GitHub https://github.com/SpunkyBot/spunkybot/issues/128#issuecomment-1048313512, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJV5CEWY4UXRXHLH3GCCDPTU4QM3FANCNFSM5OW6WA7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>