View Single Post
psychonic

BAFFLED
Join Date: May 2008
Old 02-25-2018 , 15:06   Re: name[MAX_NAME_LENGTH]
Reply With Quote #7

I'm still not fully understanding the issue.

What I do know:
  • A user's name in Steam can be 32 characters, including multi-byte characters.
  • A user's name in L4D2 gets cut off at 32 bytes internally in the engine. (m_Name on CGameClient).
  • This same behavior occurs if you manually set their name.
  • If the above happens, the cut off can be in the middle of a character, causing the corruption you mention.
  • So far, none of the above has anything to do with SourceMod. The engine can have a corrupted name.
When SourceMod first gets the name and when it caches updates to the name, it does attempt to strip off any invalid characters at the end of the name. Using MAX_NAME_LENGTH (32) should never cause further corrupt because the engine already only holds 32 bytes of the name. Regardless, GetClientName should not be able to return a name with a trailing invalid character, unless you are on an old version (SM 1.7 or lower).

Last edited by psychonic; 02-25-2018 at 16:20.
psychonic is offline