|
@@ -394,12 +394,12 @@ void queryLanServers(U32 port, U8 flags, const char* gameType, const char* missi
|
|
|
if ( !sActiveFilter.gameType || dStricmp( sActiveFilter.gameType, "Any" ) != 0 )
|
|
|
{
|
|
|
sActiveFilter.gameType = (char*) dRealloc( sActiveFilter.gameType, 4 );
|
|
|
- dStrcpy( sActiveFilter.gameType, "Any" );
|
|
|
+ dStrcpy( sActiveFilter.gameType, "Any", 4 );
|
|
|
}
|
|
|
if ( !sActiveFilter.missionType || dStricmp( sActiveFilter.missionType, "Any" ) != 0 )
|
|
|
{
|
|
|
sActiveFilter.missionType = (char*) dRealloc( sActiveFilter.missionType, 4 );
|
|
|
- dStrcpy( sActiveFilter.missionType, "Any" );
|
|
|
+ dStrcpy( sActiveFilter.missionType, "Any", 4 );
|
|
|
}
|
|
|
sActiveFilter.queryFlags = 0;
|
|
|
sActiveFilter.minPlayers = minPlayers;
|
|
@@ -510,14 +510,16 @@ void queryMasterServer(U8 flags, const char* gameType, const char* missionType,
|
|
|
// Update the active filter:
|
|
|
if ( !sActiveFilter.gameType || dStrcmp( sActiveFilter.gameType, gameType ) != 0 )
|
|
|
{
|
|
|
- sActiveFilter.gameType = (char*) dRealloc( sActiveFilter.gameType, dStrlen( gameType ) + 1 );
|
|
|
- dStrcpy( sActiveFilter.gameType, gameType );
|
|
|
+ dsize_t gameTypeLen = dStrlen(gameType) + 1;
|
|
|
+ sActiveFilter.gameType = (char*) dRealloc( sActiveFilter.gameType, gameTypeLen );
|
|
|
+ dStrcpy( sActiveFilter.gameType, gameType, gameTypeLen );
|
|
|
}
|
|
|
|
|
|
if ( !sActiveFilter.missionType || dStrcmp( sActiveFilter.missionType, missionType ) != 0 )
|
|
|
{
|
|
|
- sActiveFilter.missionType = (char*) dRealloc( sActiveFilter.missionType, dStrlen( missionType ) + 1 );
|
|
|
- dStrcpy( sActiveFilter.missionType, missionType );
|
|
|
+ dsize_t missionTypeLen = dStrlen(missionType) + 1;
|
|
|
+ sActiveFilter.missionType = (char*) dRealloc( sActiveFilter.missionType, missionTypeLen );
|
|
|
+ dStrcpy( sActiveFilter.missionType, missionType, missionTypeLen );
|
|
|
}
|
|
|
|
|
|
sActiveFilter.queryFlags = flags | ServerFilter::NewStyleResponse;
|
|
@@ -969,8 +971,9 @@ static void pushServerFavorites()
|
|
|
Net::stringToAddress( addrString, &addr );
|
|
|
ServerInfo* si = findOrCreateServerInfo( &addr );
|
|
|
AssertFatal(si, "pushServerFavorites - failed to create Server Info!" );
|
|
|
- si->name = (char*) dRealloc( (void*) si->name, dStrlen( serverName ) + 1 );
|
|
|
- dStrcpy( si->name, serverName );
|
|
|
+ dsize_t nameLen = dStrlen(serverName) + 1;
|
|
|
+ si->name = (char*) dRealloc( (void*) si->name, nameLen );
|
|
|
+ dStrcpy( si->name, serverName, nameLen );
|
|
|
si->isFavorite = true;
|
|
|
pushPingRequest( &addr );
|
|
|
}
|
|
@@ -1053,14 +1056,15 @@ void addFakeServers( S32 howMany )
|
|
|
newServer.maxPlayers = 64;
|
|
|
char buf[256];
|
|
|
dSprintf( buf, 255, "Fake server #%d", sNumFakeServers );
|
|
|
- newServer.name = (char*) dMalloc( dStrlen( buf ) + 1 );
|
|
|
- dStrcpy( newServer.name, buf );
|
|
|
+ dsize_t nameLen = dStrlen(buf) + 1;
|
|
|
+ newServer.name = (char*) dMalloc( nameLen );
|
|
|
+ dStrcpy( newServer.name, buf, nameLen );
|
|
|
newServer.gameType = (char*) dMalloc( 5 );
|
|
|
- dStrcpy( newServer.gameType, "Fake" );
|
|
|
- newServer.missionType = (char*) dMalloc( 4 );
|
|
|
- dStrcpy( newServer.missionType, "FakeMissionType" );
|
|
|
+ dStrcpy( newServer.gameType, "Fake", 5 );
|
|
|
+ newServer.missionType = (char*) dMalloc( 16 );
|
|
|
+ dStrcpy( newServer.missionType, "FakeMissionType", 16 );
|
|
|
newServer.missionName = (char*) dMalloc( 14 );
|
|
|
- dStrcpy( newServer.missionName, "FakeMapName" );
|
|
|
+ dStrcpy( newServer.missionName, "FakeMapName", 14 );
|
|
|
Net::stringToAddress( "IP:198.74.33.35:28000", &newServer.address );
|
|
|
newServer.ping = (U32)( Platform::getRandom() * 200.0f );
|
|
|
newServer.cpuSpeed = 470;
|
|
@@ -1353,9 +1357,9 @@ static void processPingsAndQueries( U32 session, bool schedule )
|
|
|
char msg[64];
|
|
|
U32 foundCount = gServerList.size();
|
|
|
if ( foundCount == 0 )
|
|
|
- dStrcpy( msg, "No servers found." );
|
|
|
+ dStrcpy( msg, "No servers found.", 64 );
|
|
|
else if ( foundCount == 1 )
|
|
|
- dStrcpy( msg, "One server found." );
|
|
|
+ dStrcpy( msg, "One server found.", 64 );
|
|
|
else
|
|
|
dSprintf( msg, sizeof( msg ), "%d servers found.", foundCount );
|
|
|
|
|
@@ -1753,8 +1757,9 @@ static void handleGameMasterInfoRequest( const NetAddress* address, U32 key, U8
|
|
|
out->write( playerCount );
|
|
|
|
|
|
const char* guidList = Con::getVariable( "Server::GuidList" );
|
|
|
- char* buf = new char[dStrlen( guidList ) + 1];
|
|
|
- dStrcpy( buf, guidList );
|
|
|
+ dsize_t bufLen = dStrlen(guidList) + 1;
|
|
|
+ char* buf = new char[bufLen];
|
|
|
+ dStrcpy( buf, guidList, bufLen );
|
|
|
char* temp = dStrtok( buf, "\t" );
|
|
|
temp8 = 0;
|
|
|
for ( ; temp && temp8 < playerCount; temp8++ )
|
|
@@ -1948,8 +1953,9 @@ static void handleGamePingResponse( const NetAddress* address, BitStream* stream
|
|
|
stream->readString( buf );
|
|
|
if ( !si->name )
|
|
|
{
|
|
|
- si->name = (char*) dMalloc( dStrlen( buf ) + 1 );
|
|
|
- dStrcpy( si->name, buf );
|
|
|
+ dsize_t bufLen = dStrlen(buf) + 1;
|
|
|
+ si->name = (char*) dMalloc(bufLen);
|
|
|
+ dStrcpy( si->name, buf, bufLen );
|
|
|
}
|
|
|
|
|
|
// Set the server up to be queried:
|
|
@@ -2050,8 +2056,9 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream
|
|
|
stream->readString( stringBuf );
|
|
|
if ( !si->gameType || dStricmp( si->gameType, stringBuf ) != 0 )
|
|
|
{
|
|
|
- si->gameType = (char*) dRealloc( (void*) si->gameType, dStrlen( stringBuf ) + 1 );
|
|
|
- dStrcpy( si->gameType, stringBuf );
|
|
|
+ dsize_t gameTypeLen = dStrlen(stringBuf) + 1;
|
|
|
+ si->gameType = (char*) dRealloc( (void*) si->gameType, gameTypeLen );
|
|
|
+ dStrcpy( si->gameType, stringBuf, gameTypeLen );
|
|
|
|
|
|
// Test against the active filter:
|
|
|
if ( applyFilter && dStricmp( sActiveFilter.gameType, "any" ) != 0
|
|
@@ -2067,8 +2074,9 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream
|
|
|
stream->readString( stringBuf );
|
|
|
if ( !si->missionType || dStrcmp( si->missionType, stringBuf ) != 0 )
|
|
|
{
|
|
|
- si->missionType = (char*) dRealloc( (void*) si->missionType, dStrlen( stringBuf ) + 1 );
|
|
|
- dStrcpy( si->missionType, stringBuf );
|
|
|
+ dsize_t missionTypeLen = dStrlen(stringBuf) + 1;
|
|
|
+ si->missionType = (char*) dRealloc( (void*) si->missionType, missionTypeLen );
|
|
|
+ dStrcpy( si->missionType, stringBuf, missionTypeLen );
|
|
|
|
|
|
// Test against the active filter:
|
|
|
if ( applyFilter && dStricmp( sActiveFilter.missionType, "any" ) != 0
|
|
@@ -2088,8 +2096,9 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream
|
|
|
*temp = '\0';
|
|
|
if ( !si->missionName || dStrcmp( si->missionName, stringBuf ) != 0 )
|
|
|
{
|
|
|
- si->missionName = (char*) dRealloc( (void*) si->missionName, dStrlen( stringBuf ) + 1 );
|
|
|
- dStrcpy( si->missionName, stringBuf );
|
|
|
+ dsize_t missionNameLen = dStrlen(stringBuf) + 1;
|
|
|
+ si->missionName = (char*) dRealloc( (void*) si->missionName, missionNameLen );
|
|
|
+ dStrcpy( si->missionName, stringBuf, missionNameLen );
|
|
|
}
|
|
|
|
|
|
// Get the server status:
|
|
@@ -2157,16 +2166,18 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream
|
|
|
stream->readString( stringBuf );
|
|
|
if ( !si->statusString || ( isUpdate && dStrcmp( si->statusString, stringBuf ) != 0 ) )
|
|
|
{
|
|
|
- si->infoString = (char*) dRealloc( (void*) si->infoString, dStrlen( stringBuf ) + 1 );
|
|
|
- dStrcpy( si->infoString, stringBuf );
|
|
|
+ dsize_t infoLen = dStrlen(stringBuf) + 1;
|
|
|
+ si->infoString = (char*) dRealloc( (void*) si->infoString, infoLen );
|
|
|
+ dStrcpy( si->infoString, stringBuf, infoLen );
|
|
|
}
|
|
|
|
|
|
// Get the content string:
|
|
|
readLongCString( stream, stringBuf );
|
|
|
if ( !si->statusString || ( isUpdate && dStrcmp( si->statusString, stringBuf ) != 0 ) )
|
|
|
{
|
|
|
- si->statusString = (char*) dRealloc( (void*) si->statusString, dStrlen( stringBuf ) + 1 );
|
|
|
- dStrcpy( si->statusString, stringBuf );
|
|
|
+ dsize_t statusLen = dStrlen(stringBuf) + 1;
|
|
|
+ si->statusString = (char*) dRealloc( (void*) si->statusString, statusLen );
|
|
|
+ dStrcpy( si->statusString, stringBuf, statusLen );
|
|
|
}
|
|
|
|
|
|
// Update the server browser gui!
|