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

Fix invalid server-assigned utf8 names with (1) prefix (fixes #3269) #3285

Merged
merged 1 commit into from
Nov 9, 2020

Conversation

def-
Copy link
Member

@def- def- commented Nov 9, 2020

Checklist

  • Tested the change ingame
  • Provided screenshots if it is a visual change
  • Tested in combination with possibly related configuration options
  • Written a unit test if it works standalone, system.c especially
  • Considered possible null pointers and out of bounds array indexing
  • Changed no physics that affect existing maps
  • Tested the change with ASan+UBSan or valgrind's memcheck (optional)

@@ -395,6 +395,7 @@ bool CServer::SetClientNameImpl(int ClientID, const char *pNameRequest, bool Set
for(int i = 1;; i++)
{
str_format(aNameTry, sizeof(aNameTry), "(%d)%s", i, aTrimmedName);
str_utf8_trim_right(aNameTry);
Copy link
Member

Choose a reason for hiding this comment

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

This seems to work but isn't the documented functionality of the function, the function says it trims whitespace on the right, but it actually trims whitespace and invalid UTF-8. The more correct function to use would be str_utf8_copy, but it would require yet another buffer. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@heinrich5991
Copy link
Member

bors r+

Thanks. :)

@bors bors bot merged commit b44bcd7 into ddnet:master Nov 9, 2020
@bors
Copy link
Contributor

bors bot commented Nov 9, 2020

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

Successfully merging this pull request may close these issues.

None yet

2 participants