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:
Jonathan Gray 2013-05-07 01:49:40 +10:00
parent fefad8e48c
commit 1a40cbbe89

View file

@ -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;