mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 09:10:54 +00:00
prevent a possible buffer overflow in Cbuf_Execute (an old q1/q2 issue this was.)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1245 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
6e6d70213a
commit
58831bf2ca
1 changed files with 10 additions and 3 deletions
|
@ -165,9 +165,16 @@ void Cbuf_Execute (void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i > (int)sizeof(line) - 1)
|
||||||
|
{
|
||||||
|
memcpy (line, text, sizeof(line) - 1);
|
||||||
|
line[sizeof(line) - 1] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
memcpy (line, text, i);
|
memcpy (line, text, i);
|
||||||
line[i] = 0;
|
line[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// delete the text from the command buffer and move remaining commands down
|
// delete the text from the command buffer and move remaining commands down
|
||||||
// this is necessary because commands (exec, alias) can insert data at the
|
// this is necessary because commands (exec, alias) can insert data at the
|
||||||
|
|
Loading…
Reference in a new issue