diff --git a/NEWS b/NEWS index ecc0aaee316..e229b4aaec3 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,8 @@ PHP NEWS . Fix memory leaks when sk_X509_new_null() fails. (ndossche) . Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails. (ndossche) + . Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails. + (ndossche) - Phar: . Fixed bug GH-20882 (buildFromIterator breaks with missing base directory). diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 415974f2fa7..12383ac8c2c 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2134,6 +2134,11 @@ PHP_FUNCTION(openssl_x509_parse) subject_name = X509_get_subject_name(cert); cert_name = X509_NAME_oneline(subject_name, NULL, 0); + if (cert_name == NULL) { + php_openssl_store_errors(); + goto err; + } + add_assoc_string(return_value, "name", cert_name); OPENSSL_free(cert_name);