Merge pull request #32684 from Faless/crypto/self_signed_cert_key_check

Fix crash when passing invalid key to Crypto.
This commit is contained in:
Rémi Verschelde 2019-10-09 16:52:20 +02:00 committed by GitHub
commit 08725bdc28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -237,6 +237,7 @@ Ref<CryptoKey> CryptoMbedTLS::generate_rsa(int p_bytes) {
Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after) {
Ref<CryptoKeyMbedTLS> key = static_cast<Ref<CryptoKeyMbedTLS> >(p_key);
ERR_FAIL_COND_V_MSG(key.is_null(), NULL, "Invalid private key argument.");
mbedtls_x509write_cert crt;
mbedtls_x509write_crt_init(&crt);