]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
cmd: Fix buffer overflow in cbuf causing Steel Storm crash if the gamedir is the...
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 26 Sep 2020 21:11:37 +0000 (21:11 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 26 Sep 2020 21:11:37 +0000 (21:11 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12950 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c

diff --git a/cmd.c b/cmd.c
index 34a5da43e4ee0ebd2fe3ffdaa40678966550e467..6ef52f52f26b2c2430f0889dce4aea9475976318 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -290,10 +290,10 @@ static size_t Cmd_ParseInput (cmd_input_t **output, char **input)
 
                (*output)->length += cmdsize;
 
-               if((*output)->size < (*output)->length + 1)
+               if((*output)->size < (*output)->length)
                {
                        (*output)->text = (char *)Mem_Realloc(cbuf_mempool, (*output)->text, (*output)->length + 1);
-                       (*output)->size = (*output)->length + 1;
+                       (*output)->size = (*output)->length;
                }
 
                strlcpy(&(*output)->text[offset], &(*input)[start], cmdsize + 1);