From 2af1e9af4d4c9398a788424f88e6b6234b84cd9a Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Sun, 5 Jul 2020 12:38:38 +0000 Subject: [PATCH] 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 --- cl_cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.39.2