1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Make sure to hold string alive when using c_str() (#3760)

This commit is contained in:
Michał Janiszewski
2016-05-27 23:32:11 +02:00
committed by Ted John
parent 6acbfa0248
commit d29af84886

View File

@@ -739,7 +739,8 @@ bool Network::BeginClient(const char* host, unsigned short port)
key.SavePrivate(privkey);
SDL_RWclose(privkey);
const utf8 *publicKeyHash = key.PublicKeyHash().c_str();
const std::string hash = key.PublicKeyHash();
const utf8 *publicKeyHash = hash.c_str();
network_get_public_key_path(keyPath, sizeof(keyPath), gConfigNetwork.player_name, publicKeyHash);
Console::WriteLine("Key generated, saving public bits as %s", keyPath);
SDL_RWops *pubkey = SDL_RWFromFile(keyPath, "wb+");