Skip to content

Commit 4c065e4

Browse files
authored
fix(ini): Replace unsafe uses of INI::getNextTokenOrNull (#2593)
1 parent f61c98b commit 4c065e4

5 files changed

Lines changed: 7 additions & 9 deletions

File tree

Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void parseUpgradePair( INI *ini, void *instance, void *store, const void *userDa
8686
throw INI_INVALID_DATA;
8787

8888

89-
token = ini->getNextTokenOrNull( ini->getSepsColon() );
89+
token = ini->getNextToken( ini->getSepsColon() );
9090
if ( stricmp(token, "Boost") == 0 )
9191
info.amount = INI::scanInt(ini->getNextToken( ini->getSepsColon() ));
9292
else

Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,12 @@ void WeaponTemplate::reset()
360360
static const char *MIN_LABEL = "Min";
361361
static const char *MAX_LABEL = "Max";
362362

363-
const char* token = ini->getNextTokenOrNull(ini->getSepsColon());
364-
363+
const char* token = ini->getNextToken(ini->getSepsColon());
365364
if( stricmp(token, MIN_LABEL) == 0 )
366365
{
367366
// Two entry min/max
368367
self->m_minDelayBetweenShots = INI::scanInt(ini->getNextToken(ini->getSepsColon()));
369-
token = ini->getNextTokenOrNull(ini->getSepsColon());
368+
token = ini->getNextToken(ini->getSepsColon());
370369
if( stricmp(token, MAX_LABEL) != 0 )
371370
{
372371
// Messed up double entry

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void parseUpgradePair( INI *ini, void *instance, void *store, const void *userDa
8787
throw INI_INVALID_DATA;
8888

8989

90-
token = ini->getNextTokenOrNull( ini->getSepsColon() );
90+
token = ini->getNextToken( ini->getSepsColon() );
9191
if ( stricmp(token, "Boost") == 0 )
9292
info.amount = INI::scanInt(ini->getNextToken( ini->getSepsColon() ));
9393
else

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void parseFactionObjectCreationList( INI *ini, void *instance, void *store, cons
6161
throw INI_INVALID_DATA;
6262

6363

64-
token = ini->getNextTokenOrNull( ini->getSepsColon() );
64+
token = ini->getNextToken( ini->getSepsColon() );
6565
if ( stricmp(token, "OCL") == 0 )
6666
ini->parseObjectCreationList( ini, instance, &info.m_ocl, nullptr );
6767
else

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,12 @@ void WeaponTemplate::reset()
374374
static const char *MIN_LABEL = "Min";
375375
static const char *MAX_LABEL = "Max";
376376

377-
const char* token = ini->getNextTokenOrNull(ini->getSepsColon());
378-
377+
const char* token = ini->getNextToken(ini->getSepsColon());
379378
if( stricmp(token, MIN_LABEL) == 0 )
380379
{
381380
// Two entry min/max
382381
self->m_minDelayBetweenShots = INI::scanInt(ini->getNextToken(ini->getSepsColon()));
383-
token = ini->getNextTokenOrNull(ini->getSepsColon());
382+
token = ini->getNextToken(ini->getSepsColon());
384383
if( stricmp(token, MAX_LABEL) != 0 )
385384
{
386385
// Messed up double entry

0 commit comments

Comments
 (0)