From 0a430b51805bc080eaaa96beb5b3ecbc6514cfd9 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Sat, 26 Sep 2020 21:11:37 +0000 Subject: [PATCH] cmd: Fix buffer overflow in cbuf causing Steel Storm crash if the gamedir is the same as the homedir git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12950 d7cf8633-e32d-0410-b094-e92efae38249 --- cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd.c b/cmd.c index 34a5da43..6ef52f52 100644 --- 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); -- 2.39.2