From: cloudwalk Date: Sun, 5 Jul 2020 12:38:38 +0000 (+0000) Subject: Fix nasty typo in a dpsnprintf causing truncated cmds. Memory safety? PFFT (/s) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2af1e9af4d4c9398a788424f88e6b6234b84cd9a;p=xonotic%2Fdarkplaces.git Fix nasty typo in a dpsnprintf causing truncated cmds. Memory safety? PFFT (/s) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12787 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_cmd.c b/cl_cmd.c index b6e6e8c0..f6ef99d8 100644 --- 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