mirror of
https://github.com/ioquake/jedi-academy.git
synced 2024-11-24 21:21:33 +00:00
Fix to COM_ParseExt 1 byte overwrite bug
from Tim Angus in ioquake3 svn 95 git 33a48a0336865a9d21983e4836920cd9f3401101 Fix to COM_ParseExt 1 byte overwrite bug from http://www.quakesrc.org/forums/viewtopic.php?t=5374
This commit is contained in:
parent
fefad8e48c
commit
1a40cbbe89
1 changed files with 2 additions and 7 deletions
|
@ -492,7 +492,7 @@ char *COM_ParseExt( const char **data_p, qboolean allowLineBreaks )
|
|||
*data_p = ( char * ) data;
|
||||
return com_token;
|
||||
}
|
||||
if (len < MAX_TOKEN_CHARS)
|
||||
if (len < MAX_TOKEN_CHARS - 1)
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
|
@ -503,7 +503,7 @@ char *COM_ParseExt( const char **data_p, qboolean allowLineBreaks )
|
|||
// parse a regular word
|
||||
do
|
||||
{
|
||||
if (len < MAX_TOKEN_CHARS)
|
||||
if (len < MAX_TOKEN_CHARS - 1)
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
|
@ -514,11 +514,6 @@ char *COM_ParseExt( const char **data_p, qboolean allowLineBreaks )
|
|||
com_lines++;
|
||||
} while (c>32);
|
||||
|
||||
if (len == MAX_TOKEN_CHARS)
|
||||
{
|
||||
// Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
|
||||
len = 0;
|
||||
}
|
||||
com_token[len] = 0;
|
||||
|
||||
*data_p = ( char * ) data;
|
||||
|
|
Loading…
Reference in a new issue