diff options
author | Andrey Nazarov <skuller@skuller.net> | 2009-01-13 12:35:48 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2009-01-13 12:35:48 +0000 |
commit | cea680b72a6a2207ea301ef9026ecda087502065 (patch) | |
tree | 02619e5de9ef5211c9591b3a488ac80d71ef1423 /source/cl_parse.c | |
parent | 440058ed94a61fddee4e2e8ab302628d78945447 (diff) |
Client and server are now more tolerant to configstring overflows.
Diffstat (limited to 'source/cl_parse.c')
-rw-r--r-- | source/cl_parse.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/cl_parse.c b/source/cl_parse.c index 2aa1163..cc5d8a8 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -665,26 +665,28 @@ static void CL_ParseConfigstring( int index ) { if( index < 0 || index >= MAX_CONFIGSTRINGS ) { Com_Error( ERR_DROP, "%s: bad index: %d", __func__, index ); } - string = cl.configstrings[index]; + string = cl.configstrings[index]; maxlen = CS_SIZE( index ); len = MSG_ReadString( string, maxlen ); - if( len >= maxlen ) { - Com_Error( ERR_DROP, "%s: index %d overflowed: %"PRIz" > %"PRIz, - __func__, index, len, maxlen - 1 ); - } if( cl_shownet->integer > 2 ) { Com_Printf( " %d \"%s\"\n", index, Q_FormatString( string ) ); } + maxlen = CS_SIZE( index ); + if( len >= maxlen ) { + Com_WPrintf( + "%s: index %d overflowed: %"PRIz" > %"PRIz"\n", + __func__, index, len, maxlen - 1 ); + len = maxlen - 1; + } + if( cls.demo.recording && cls.demo.paused ) { Q_SetBit( cl.dcs, index ); } - // do something apropriate - if( index == CS_MAXCLIENTS ) { cl.maxclients = atoi( string ); return; @@ -705,7 +707,6 @@ static void CL_ParseConfigstring( int index ) { if( cls.state < ca_precached ) { return; } - if (index >= CS_MODELS+2 && index < CS_MODELS+MAX_MODELS) { cl.model_draw[index-CS_MODELS] = R_RegisterModel (string); if (*string == '*') |