From e9abcbac3b75b2d99f04d26614826e469c47abbc Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Wed, 9 Oct 2019 15:59:17 +0200 Subject: [PATCH] Fix crash when passing invalid key to Crypto. In generate_self_signed_certificate --- modules/mbedtls/crypto_mbedtls.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp index ca656b4b9b3..204f4e89058 100644 --- a/modules/mbedtls/crypto_mbedtls.cpp +++ b/modules/mbedtls/crypto_mbedtls.cpp @@ -237,6 +237,7 @@ Ref CryptoMbedTLS::generate_rsa(int p_bytes) { Ref CryptoMbedTLS::generate_self_signed_certificate(Ref p_key, String p_issuer_name, String p_not_before, String p_not_after) { Ref key = static_cast >(p_key); + ERR_FAIL_COND_V_MSG(key.is_null(), NULL, "Invalid private key argument."); mbedtls_x509write_cert crt; mbedtls_x509write_crt_init(&crt);