]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix nasty typo in a dpsnprintf causing truncated cmds. Memory safety? PFFT (/s)
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Jul 2020 12:38:38 +0000 (12:38 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Jul 2020 12:38:38 +0000 (12:38 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12787 d7cf8633-e32d-0410-b094-e92efae38249

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