mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Allow utf8 ban reasons (fixes #3329)
This commit is contained in:
parent
f8b07f705e
commit
d99f1b9340
|
@ -2417,19 +2417,6 @@ char *str_trim_words(char *str, int words)
|
|||
return str;
|
||||
}
|
||||
|
||||
/* makes sure that the string only contains the characters between 32 and 127 */
|
||||
void str_sanitize_strong(char *str_in)
|
||||
{
|
||||
unsigned char *str = (unsigned char *)str_in;
|
||||
while(*str)
|
||||
{
|
||||
*str &= 0x7f;
|
||||
if(*str < 32)
|
||||
*str = 32;
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
/* makes sure that the string only contains the characters between 32 and 255 */
|
||||
void str_sanitize_cc(char *str_in)
|
||||
{
|
||||
|
|
|
@ -1101,18 +1101,6 @@ int str_format(char *buffer, int buffer_size, const char *format, ...)
|
|||
*/
|
||||
char *str_trim_words(char *str, int words);
|
||||
|
||||
/*
|
||||
Function: str_sanitize_strong
|
||||
Replaces all characters below 32 and above 127 with whitespace.
|
||||
|
||||
Parameters:
|
||||
str - String to sanitize.
|
||||
|
||||
Remarks:
|
||||
- The strings are treated as zero-terminated strings.
|
||||
*/
|
||||
void str_sanitize_strong(char *str);
|
||||
|
||||
/*
|
||||
Function: str_sanitize_cc
|
||||
Replaces all characters below 32 with whitespace.
|
||||
|
|
|
@ -294,11 +294,8 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr, SECURITY_
|
|||
if(pPacket->m_DataSize > 1)
|
||||
{
|
||||
// make sure to sanitize the error string form the other party
|
||||
if(pPacket->m_DataSize < 128)
|
||||
str_copy(aStr, (char *)&pPacket->m_aChunkData[1], pPacket->m_DataSize);
|
||||
else
|
||||
str_copy(aStr, (char *)&pPacket->m_aChunkData[1], sizeof(aStr));
|
||||
str_sanitize_strong(aStr);
|
||||
str_utf8_copy(aStr, (char *)&pPacket->m_aChunkData[1], minimum(pPacket->m_DataSize, (int)sizeof(aStr)));
|
||||
str_sanitize_cc(aStr);
|
||||
}
|
||||
|
||||
if(!m_BlockCloseMsg)
|
||||
|
|
Loading…
Reference in a new issue