From: havoc Date: Thu, 14 Jun 2007 07:02:09 +0000 (+0000) Subject: moved name validation code to server side X-Git-Tag: xonotic-v0.1.0preview~3038 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=028f30e0d2b47fe698ac49e2a777c49b55393627;p=xonotic%2Fdarkplaces.git moved name validation code to server side git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7423 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host_cmd.c b/host_cmd.c index b69389c1..ee5fdcdf 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -754,11 +754,6 @@ 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); @@ -776,6 +771,11 @@ void Host_Name_f (void) // point the string back at updateclient->name to keep it safe strlcpy (host_client->name, newName, sizeof (host_client->name)); + for (i = 0, j = 0;host_client->name[i];i++) + if (host_client->name[i] != '\r' && host_client->name[i] != '\n') + host_client->name[j++] = host_client->name[i]; + host_client->name[j] = 0; + COM_StringLengthNoColors(host_client->name, 0, &valid_colors); if(!valid_colors) // NOTE: this also proves the string is not empty, as "" is a valid colored string {