]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
fix rcon_password validation to refuse whitespace, and refuse empty passwords (as...
[xonotic/darkplaces.git] / host_cmd.c
index 2c5d185fd52a36350072d2289b91895e820de5fd..98b7d090067f73effdda2a32dc1d21bbd0504f84 100644 (file)
@@ -1972,15 +1972,25 @@ Host_Rcon_f
 */
 void Host_Rcon_f (void) // credit: taken from QuakeWorld
 {
+       int i;
        lhnetaddress_t to;
        lhnetsocket_t *mysocket;
 
-       if (!rcon_password.string)
+       if (!rcon_password.string || !rcon_password.string[0])
        {
                Con_Printf ("You must set rcon_password before issuing an rcon command.\n");
                return;
        }
 
+       for (i = 0;rcon_password.string[i];i++)
+       {
+               if (rcon_password.string[i] <= ' ')
+               {
+                       Con_Printf("rcon_password is not allowed to have any whitespace.\n");
+                       return;
+               }
+       }
+
        if (cls.netcon)
                to = cls.netcon->peeraddress;
        else