From 7db9030b6ff234e00e486d1a1dd7ba1e1e69e410 Mon Sep 17 00:00:00 2001 From: WPMGPRoSToTeMa Date: Thu, 16 Jul 2015 02:29:57 +0300 Subject: [PATCH] Added iswprint check in Q_IsUnprintableW function Added Q_StripUnprintableAndSpace function using for player name --- rehlds/engine/sv_main.cpp | 10 ++++++++++ rehlds/engine/unicode_strtools.cpp | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index b201a27..1cdc033 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -2098,7 +2098,12 @@ int SV_CheckUserInfo(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, in *pChar = ' '; } +#ifdef REHLDS_FIXES + Q_strcpy(name, newname); + Q_StripUnprintableAndSpace(name); +#else // REHLDS_FIXES TrimSpace(newname, name); +#endif // REHLDS_FIXES if (!Q_UnicodeValidate(name)) { @@ -4807,7 +4812,12 @@ void SV_ExtractFromUserinfo(client_t *cl) *p = ' '; } +#ifdef REHLDS_FIXES + Q_strcpy(newname, rawname); + Q_StripUnprintableAndSpace(newname); +#else // REHLDS_FIXES TrimSpace(rawname, newname); +#endif // REHLDS_FIXES if (!Q_UnicodeValidate(newname)) { diff --git a/rehlds/engine/unicode_strtools.cpp b/rehlds/engine/unicode_strtools.cpp index b2c7416..8d9932d 100644 --- a/rehlds/engine/unicode_strtools.cpp +++ b/rehlds/engine/unicode_strtools.cpp @@ -116,6 +116,11 @@ decodeFinishedMaybeCESU8: int __cdecl Q_IsUnprintableW(uchar16 c) { +#ifdef REHLDS_FIXES + if (!iswprint(c)) + return 1; +#endif // REHLDS_FIXES + switch (c) { case 0x202A: