mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-01 06:00:45 +00:00
Cleanup chatbox sanitizing code
This commit is contained in:
parent
34ad64ba59
commit
f8afdeb35f
1 changed files with 9 additions and 6 deletions
|
@ -966,18 +966,21 @@ static void HU_queueChatChar(char c)
|
||||||
{
|
{
|
||||||
char buf[2+256];
|
char buf[2+256];
|
||||||
char *msg = &buf[2];
|
char *msg = &buf[2];
|
||||||
size_t ci = 2;
|
size_t ci;
|
||||||
INT32 target = 0;
|
INT32 target = 0;
|
||||||
|
|
||||||
// if our message was nothing but spaces, don't send it.
|
// if our message was nothing but spaces, don't send it.
|
||||||
if (HU_chatboxContainsOnlySpaces())
|
if (HU_chatboxContainsOnlySpaces())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do {
|
// copy printable characters and terminating '\0' only.
|
||||||
c = w_chat[-2+ci++];
|
for (ci = 2; w_chat[ci-2]; ci++)
|
||||||
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
{
|
||||||
buf[ci-1]=c;
|
c = w_chat[ci-2];
|
||||||
} while (c);
|
if (c >= ' ' && !(c & 0x80))
|
||||||
|
buf[ci] = c;
|
||||||
|
};
|
||||||
|
buf[ci] = '\0';
|
||||||
|
|
||||||
memset(w_chat, '\0', HU_MAXMSGLEN);
|
memset(w_chat, '\0', HU_MAXMSGLEN);
|
||||||
c_input = 0;
|
c_input = 0;
|
||||||
|
|
Loading…
Reference in a new issue