[Rseding91] [1.1.88] Invalid LAN Player Names Are Accepted
Posted: Sat Jul 29, 2023 6:17 pm
Summary:
It is possible to create (and use) an invalid LAN player name with spaces in it, if you enter it in a particular spot. (I haven't tested other kinds of invalid names)If you change your name via Settings->Other->LAN Player Name, then it behaves as normal, rejecting names with spaces. But if you are a new player, and you go to join or host a multiplayer game without setting up your name first, you get a small pop-up box asking you to set your name. In this box, names with spaces are accepted.
The Story:
My friend accidentally joined our game with an invalid player name, specifically a name with spaces in it. Then, he logged in (changing his name) and all his stuff was gone. Now I (as the admin) can't /swap-players his stuff to his new (valid) player, because the space in his old name confuses swap-players.Steps To Reproduce:
1. a) Open a fresh .zip copy of the game ORb) Navigate to settings->other, log off (if logged in), and clear the LAN Player Name box (i.e. make it empty).
2. Return to the main menu.
3. Click multiplayer.
4. Click anything other than "Browse Public" (since you can't reproduce the bug when logged in).
5. Proceed through the appropriate UI for hosting or joining, whichever you clicked.
6. Eventually, the game pops up a box asking for your name.
7. Enter a name with spaces in it. This ought to be rejected, but it will be allowed instead.
8. Play the game. This shouldn't be possible, but it is.
Recommendations:
1. Give /swap-players the ability to target invalidly named players, so people who already have invalidly-named characters can recover their stuff.2. Make all player name entry boxes use the same is_name_valid() code to prevent this happening in the future.
3. Or maybe auto-convert invalid names to a valid one upon joining the game?
Notes:
This bug is uniquely visible to new players. Established players likely play while logged in (since using the public server requires it) or they chose a valid name long ago and never change it. If they do change it, they do so through the Settings->Other menu where the rules are enforced. Nobody would think of first clearing the box on that menu, in order to get the pop-up box in the multiplayer to appear again.It is possible to recover your stuff if you accidentally started as an invalid-named character. As long as you're still that name, you can leave and rejoin at will and nothing bad will happen. So you could just keep playing. You could also put all your stuff in a box, change your name, then come and get it. You could also launch a zip copy of the game alongside, join from that copy as your new intended name, then have your main (invalid) character /swap-players with the new valid name. (I haven't tested this, but it may work since it's being run by the invalid player, they don't have to type an invalid name into the console.)
If you started as invalid-named character, and you've already changed your name and now can't get back into that character (as happened to my friend), it's not too late.
1. Go into Settings->Other
2. Click on LAN Player Name
3. Backspace/delete everything in the box. It must be empty. Surprisingly, the game will allow an empty box here.
4. Click Confirm.
5. Go join or host your game where you have the invalid character.
6. You will again encounter the pop-up prompt asking for your name. Enter the invalid name exactly.
7. You're In! Do what you wish - keep playing, stash your stuff, etc.