From: cloudwalk Date: Sat, 26 Sep 2020 21:11:37 +0000 (+0000) Subject: cmd: Fix buffer overflow in cbuf causing Steel Storm crash if the gamedir is the... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0a430b51805bc080eaaa96beb5b3ecbc6514cfd9;p=xonotic%2Fdarkplaces.git 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 --- 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);