From ab8eed6efbaabfb248c857b17d03d07a817d1345 Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Sat, 1 Feb 2020 18:10:58 -0800
Subject: [PATCH] Add missing conditions to CleanupPlayerName

---
 src/d_netcmd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 23ec00b2ec..b74a8a76d9 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -1010,6 +1010,17 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
 
 		tmpname = p;
 
+		do
+		{
+			/* from EnsurePlayerNameIsGood */
+			if (!isprint(*p) || *p == ';' || (UINT8)*p >= 0x80)
+				break;
+		}
+		while (*++p) ;
+
+		if (*p)/* bad char found */
+			break;
+
 		// Remove trailing spaces.
 		p = &tmpname[strlen(tmpname)-1]; // last character
 		while (*p == ' ' && p >= tmpname)
-- 
GitLab