mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.5'
* PHP-8.5: Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
This commit is contained in:
@@ -1032,6 +1032,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);
|
||||
|
||||
@@ -1064,6 +1069,12 @@ PHP_FUNCTION(openssl_x509_parse)
|
||||
}
|
||||
|
||||
str_serial = i2s_ASN1_INTEGER(NULL, asn1_serial);
|
||||
/* Can return NULL on error or memory allocation failure */
|
||||
if (!str_serial) {
|
||||
php_openssl_store_errors();
|
||||
goto err;
|
||||
}
|
||||
|
||||
add_assoc_string(return_value, "serialNumber", str_serial);
|
||||
OPENSSL_free(str_serial);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user