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

Handle malformed private keys gracefully

This commit is contained in:
Michał Janiszewski
2016-05-21 22:43:59 +02:00
parent 553e1bdf0f
commit 66abc31fee
2 changed files with 16 additions and 3 deletions

View File

@@ -110,7 +110,7 @@ bool NetworkKey::LoadPrivate(SDL_RWops * file)
}
RSA * rsa;
rsa = PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, nullptr);
if (!RSA_check_key(rsa))
if (rsa == nullptr || !RSA_check_key(rsa))
{
log_error("Loaded RSA key is invalid");
BIO_free_all(bio);