]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_cmd.c
Fix nasty typo in a dpsnprintf causing truncated cmds. Memory safety? PFFT (/s)
[xonotic/darkplaces.git] / cl_cmd.c
index b6e6e8c05b3b67c14b5133b5e74c153e05958350..f6ef99d8fa4293d815882a5af2d081f195ae2759 100644 (file)
--- a/cl_cmd.c
+++ b/cl_cmd.c
@@ -182,7 +182,8 @@ void CL_ForwardToServer_f (cmd_state_t *cmd)
                // we need to keep the command name, so send Cmd_Argv(cmd, 0), a space and then Cmd_Args(cmd)
                i = dpsnprintf(vabuf, sizeof(vabuf), "%s", Cmd_Argv(cmd, 0));
                if(Cmd_Argc(cmd) > 1)
-                       dpsnprintf(&vabuf[i], sizeof(vabuf - i), " %s", Cmd_Args(cmd));
+                       // (i + 1) accounts for the added space
+                       dpsnprintf(&vabuf[i], sizeof(vabuf) - (i + 1), " %s", Cmd_Args(cmd));
                s = vabuf;
        }
        // don't send an empty forward message if the user tries "cmd" by itself