]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
moved name validation code to server side
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Jun 2007 07:02:09 +0000 (07:02 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Jun 2007 07:02:09 +0000 (07:02 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7423 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c

index b69389c1d91ae43fd3145b51ba49274daf8eab13..ee5fdcdf0240b9a002130291732e1bcf282f551e 100644 (file)
@@ -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
        {