safe .def spawnflags parsing
This commit is contained in:
parent
3eff56211d
commit
4b96cb6744
|
|
@ -248,24 +248,20 @@ EntityClass *Eclass_InitFromText( const char *text ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char parms[256];
|
StringRange parms( text, text );
|
||||||
// get the flags
|
{ // get the flags: advance to the first \n
|
||||||
{
|
while ( *text && *text++ != '\n' ){};
|
||||||
// copy to the first /n
|
parms = { parms.begin(), text };
|
||||||
char* p = parms;
|
( *text && ++text );
|
||||||
while ( *text && *text != '\n' )
|
|
||||||
*p++ = *text++;
|
|
||||||
*p = 0;
|
|
||||||
text++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// any remaining words are parm flags
|
// any remaining words are parm flags
|
||||||
const char* p = parms;
|
const char* p = parms.begin();
|
||||||
for ( std::size_t i = 0; i < MAX_FLAGS; i++ )
|
for ( std::size_t i = 0; i < MAX_FLAGS; i++ )
|
||||||
{
|
{
|
||||||
p = COM_Parse( p );
|
p = COM_Parse( p );
|
||||||
if ( !p ) {
|
if ( p == nullptr || p > parms.end() ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( string_equal( Get_COM_Token(), "-" )
|
if( string_equal( Get_COM_Token(), "-" )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user