summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-09 16:52:20 +0200
committerGitHub <noreply@github.com>2019-10-09 16:52:20 +0200
commit08725bdc28e05b53179e0464691c49e589e10944 (patch)
treec877c0d0b76310b958c92b435ab329799d968da8
parentdd23d0b635ffe3f9292e00e15ce7a35e1bb22e71 (diff)
parente9abcbac3b75b2d99f04d26614826e469c47abbc (diff)
Merge pull request #32684 from Faless/crypto/self_signed_cert_key_check
Fix crash when passing invalid key to Crypto.
-rw-r--r--modules/mbedtls/crypto_mbedtls.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp
index ca656b4b9b..204f4e8905 100644
--- a/modules/mbedtls/crypto_mbedtls.cpp
+++ b/modules/mbedtls/crypto_mbedtls.cpp
@@ -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);