Skip to content

Conversation

@slurmlord
Copy link

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-L869C1

The 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.

Copy link

@OmniBlade OmniBlade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay to me.

@xezon xezon added Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker Network Anything related to network, servers Gen Relates to Generals ZH Relates to Zero Hour labels Sep 19, 2025
xezon
xezon previously approved these changes Sep 20, 2025
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of banning \f\n\r\t\v, how about banning all characters less than 32 ? That includes all control characters.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link

@xezon xezon Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs testing. I just tested Network lobby with nickname öäü and it triggered Asserts in Debug, but otherwise worked.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@xezon xezon changed the title bugfix(network): Deny players with invalid names from joining game bugfix(network): Deny players with invalid names from joining a LAN game room Sep 20, 2025
@xezon xezon dismissed their stale review September 21, 2025 16:31

A few more comments.

@xezon
Copy link

xezon commented Sep 30, 2025

Will this see another revision or is this final?

@xezon xezon added the Approved Pull Request was approved label Oct 21, 2025
@xezon
Copy link

xezon commented Oct 25, 2025

It would be good to get this finalized.

@slurmlord
Copy link
Author

Will this see another revision or is this final?

Sorry, I missed this comment entirely - will make another pass with limiting characters to only from the BMP.

@slurmlord
Copy link
Author

Broadened the definition of illegal and space characters:

  • Low and high surrogates are now flagged as not OK
  • All character codes below 0x20 are rejected (C0)
  • Character codes from C1 are also rejected
  • Reject line and paragraph separators
  • Consider all char codes from the Unicode Space Separator category as space

Validated with some non-ASCII player names
Screenshot From 2025-10-27 23-24-56

Verified that players with "," (example of forbidden char) in the name are denied
Screenshot From 2025-10-27 23-25-23

@slurmlord slurmlord force-pushed the deny-invalid-lanplayernames branch from df66d16 to 3c3c5f2 Compare November 13, 2025 19:55
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks mostly good.

@xezon xezon merged commit da26e01 into TheSuperHackers:main Nov 14, 2025
17 checks passed
@slurmlord slurmlord deleted the deny-invalid-lanplayernames branch November 14, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Pull Request was approved Bug Something is not working right, typically is user facing Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker Network Anything related to network, servers ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants