From: havoc Date: Sat, 22 May 2004 03:12:27 +0000 (+0000) Subject: Host_Name_f now validates player names, stripping \r and \n control codes X-Git-Tag: xonotic-v0.1.0preview~5819 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=714da77f3ec9124d1b3e783c43d10cd8e73e5221;p=xonotic%2Fdarkplaces.git Host_Name_f now validates player names, stripping \r and \n control codes git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4236 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host_cmd.c b/host_cmd.c index 1298a327..7ded7c47 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -671,6 +671,7 @@ Host_Name_f cvar_t cl_name = {CVAR_SAVE, "_cl_name", "player"}; void Host_Name_f (void) { + int i, j; char newName[sizeof(host_client->name)]; if (Cmd_Argc () == 1) @@ -684,6 +685,11 @@ void Host_Name_f (void) else strlcpy (newName, Cmd_Args(), sizeof (newName)); + for (i = 0, j = 0;newName[i];i++) + if (newName[i] != '\r' && newName[i] != '\n') + newName[j++] = newName[i]; + newName[j] = 0; + if (cmd_source == src_command) { Cvar_Set ("_cl_name", newName);