Handle malformed private keys gracefully

This commit is contained in:
Michał Janiszewski committed 2016-05-27 20:28:33 +02:00
1 parent 553e1bdf0f
commit 66abc31fee
2 files changed
+16 -3

No files matched your search

+1 -1
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);