mirror of
https://github.com/ValveSoftware/GameNetworkingSockets.git
synced 2026-05-29 16:20:34 +00:00
Fix dangling pointer bug
If there is more than one STUN server and the name is
shorter than std::string small string optimization size.
(cherry picked from commit b88a52c206)
This commit is contained in:
@@ -134,8 +134,11 @@ void CSteamNetworkConnectionP2P::CheckInitICE()
|
||||
server.append( pszAddress );
|
||||
|
||||
vecStunServers.push_back( std::move( server ) );
|
||||
vecStunServersPsz.push_back( vecStunServers.rbegin()->c_str() );
|
||||
}
|
||||
// Build the pointer array after vecStunServers is fully populated;
|
||||
// doing it inside the loop would produce dangling pointers on reallocation.
|
||||
for ( const std::string &s: vecStunServers )
|
||||
vecStunServersPsz.push_back( s.c_str() );
|
||||
}
|
||||
if ( vecStunServers.empty() )
|
||||
SpewWarningGroup( LogLevel_P2PRendezvous(), "[%s] Reflexive candidates enabled by P2P_Transport_ICE_Enable, but P2P_STUN_ServerList is empty\n", GetDescription() );
|
||||
|
||||
Reference in New Issue
Block a user