bugfix(network): Deny players with invalid names from joining a LAN game room#1595
Conversation
xezon
left a comment
There was a problem hiding this comment.
Some more thoughts after taking another look.
| // should not be in a player name. It should also not consist of only space characters. | ||
| if (canJoin) | ||
| { | ||
| constexpr WideChar IllegalNameChars[] = L",:;|\f\n\r\t\v"; |
There was a problem hiding this comment.
Instead of banning \f\n\r\t\v, how about banning all characters less than 32 ? That includes all control characters.
There was a problem hiding this comment.
Yes, that makes sense. As these are wide chars, are there other values or sequences beyond the traditional ASCII control characters that we should consider as well?
There was a problem hiding this comment.
I think this needs testing. I just tested Network lobby with nickname öäü and it triggered Asserts in Debug, but otherwise worked.
There was a problem hiding this comment.
Yes, testing is definitely needed here.
I was thinking of things like Surrogate pairs and Unicode special characters that will require a lot more validation/handling that what is proposed in this PR right now.
Should we limit names to only characters in the BMP for example? Require the string to be normalized to a specific normalization form?
|
Will this see another revision or is this final? |
|
It would be good to get this finalized. |
Sorry, I missed this comment entirely - will make another pass with limiting characters to only from the BMP. |
df66d16 to
3c3c5f2
Compare


This change introduces an extra validation of player names before they are allowed to join a network game.
Specifically, player names containing
,;or:are denied, as they will cause trouble with the parsing of the string representation of the GameInfo. This set of characters mirrors the set of disallowed characters in https://github.com/TheSuperHackers/GeneralsGameCode/blob/dd2bb780a9226186e1d1ffe0dc60fc8000134117/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp#L861C1-L869C1The player attempting to join will be presented with a "duplicate name" error, hinting that the name needs to be changed, as we can't introduce a new error type and retain retail compatibility.