mirror of
https://github.com/UberGames/ioef.git
synced 2025-01-18 23:21:37 +00:00
Fix error handling in R_ParseSpawnVars
When R_GetEntityToken returns qfalse it resets pointer for parsing, by R_ParseSpawnVars not returning qfalse it could cause an infinite loop. Also add newlines to printfs.
This commit is contained in:
parent
e7f43545ed
commit
b98e6d5cc0
1 changed files with 12 additions and 10 deletions
|
@ -2749,7 +2749,8 @@ qboolean R_ParseSpawnVars( char *spawnVarChars, int maxSpawnVarChars, int *numSp
|
|||
return qfalse;
|
||||
}
|
||||
if ( com_token[0] != '{' ) {
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: found %s when expecting {",com_token );
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: found %s when expecting {\n",com_token );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
// go through all the key / value pairs
|
||||
|
@ -2758,7 +2759,8 @@ qboolean R_ParseSpawnVars( char *spawnVarChars, int maxSpawnVarChars, int *numSp
|
|||
|
||||
// parse key
|
||||
if ( !R_GetEntityToken( keyname, sizeof( keyname ) ) ) {
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: EOF without closing brace" );
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: EOF without closing brace\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( keyname[0] == '}' ) {
|
||||
|
@ -2767,18 +2769,18 @@ qboolean R_ParseSpawnVars( char *spawnVarChars, int maxSpawnVarChars, int *numSp
|
|||
|
||||
// parse value
|
||||
if ( !R_GetEntityToken( com_token, sizeof( com_token ) ) ) {
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: EOF without closing brace" );
|
||||
break;
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: EOF without closing brace\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( com_token[0] == '}' ) {
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: closing brace without data" );
|
||||
break;
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: closing brace without data\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( *numSpawnVars == MAX_SPAWN_VARS ) {
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: MAX_SPAWN_VARS" );
|
||||
break;
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: MAX_SPAWN_VARS\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
keyLength = strlen(keyname) + 1;
|
||||
|
@ -2786,8 +2788,8 @@ qboolean R_ParseSpawnVars( char *spawnVarChars, int maxSpawnVarChars, int *numSp
|
|||
|
||||
if (numSpawnVarChars + keyLength + tokenLength > maxSpawnVarChars)
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: MAX_SPAWN_VAR_CHARS" );
|
||||
break;
|
||||
ri.Printf( PRINT_ALL, "R_ParseSpawnVars: MAX_SPAWN_VAR_CHARS\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
strcpy(spawnVarChars + numSpawnVarChars, keyname);
|
||||
|
|
Loading…
Reference in a new issue