Browse Source

engine: server: fix ParseFile calls

pull/2/head
Alibek Omarov 3 years ago committed by a1batross
parent
commit
a8c877c841
  1. 12
      engine/server/sv_game.c
  2. 2
      engine/server/sv_init.c

12
engine/server/sv_game.c

@ -908,12 +908,12 @@ uint SV_MapIsValid( const char *filename, const char *spawn_entity, const char *
pfile = ents; pfile = ents;
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( !Q_strcmp( token, "classname" )) if( !Q_strcmp( token, "classname" ))
{ {
// check classname for spawn entity // check classname for spawn entity
pfile = COM_ParseFile( pfile, check_name ); pfile = COM_ParseFile( pfile, check_name, sizeof( check_name ));
if( !Q_strcmp( spawn_entity, check_name )) if( !Q_strcmp( spawn_entity, check_name ))
{ {
SetBits( flags, MAP_HAS_SPAWNPOINT ); SetBits( flags, MAP_HAS_SPAWNPOINT );
@ -926,7 +926,7 @@ uint SV_MapIsValid( const char *filename, const char *spawn_entity, const char *
else if( need_landmark && !Q_strcmp( token, "targetname" )) else if( need_landmark && !Q_strcmp( token, "targetname" ))
{ {
// check targetname for landmark entity // check targetname for landmark entity
pfile = COM_ParseFile( pfile, check_name ); pfile = COM_ParseFile( pfile, check_name, sizeof( check_name ));
if( !Q_strcmp( landmark_name, check_name )) if( !Q_strcmp( landmark_name, check_name ))
{ {
@ -4747,14 +4747,14 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent )
string keyname; string keyname;
// parse key // parse key
if(( *pfile = COM_ParseFile( *pfile, token )) == NULL ) if(( *pfile = COM_ParseFile( *pfile, token, sizeof( token ))) == NULL )
Host_Error( "ED_ParseEdict: EOF without closing brace\n" ); Host_Error( "ED_ParseEdict: EOF without closing brace\n" );
if( token[0] == '}' ) break; // end of desc if( token[0] == '}' ) break; // end of desc
Q_strncpy( keyname, token, sizeof( keyname )); Q_strncpy( keyname, token, sizeof( keyname ));
// parse value // parse value
if(( *pfile = COM_ParseFile( *pfile, token )) == NULL ) if(( *pfile = COM_ParseFile( *pfile, token, sizeof( token ))) == NULL )
Host_Error( "ED_ParseEdict: EOF without closing brace\n" ); Host_Error( "ED_ParseEdict: EOF without closing brace\n" );
if( token[0] == '}' ) if( token[0] == '}' )
@ -4916,7 +4916,7 @@ void SV_LoadFromFile( const char *mapname, char *entities )
inhibited = 0; inhibited = 0;
// parse ents // parse ents
while(( entities = COM_ParseFile( entities, token )) != NULL ) while(( entities = COM_ParseFile( entities, token, sizeof( token ))) != NULL )
{ {
if( token[0] != '{' ) if( token[0] != '{' )
Host_Error( "ED_LoadFromFile: found %s when expecting {\n", token ); Host_Error( "ED_LoadFromFile: found %s when expecting {\n", token );

2
engine/server/sv_init.c

@ -287,7 +287,7 @@ void SV_ReadResourceList( const char *filename )
Con_DPrintf( "Precaching from %s\n", filename ); Con_DPrintf( "Precaching from %s\n", filename );
Con_DPrintf( "----------------------------------\n" ); Con_DPrintf( "----------------------------------\n" );
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( !COM_IsSafeFileToDownload( token )) if( !COM_IsSafeFileToDownload( token ))
continue; continue;

Loading…
Cancel
Save