Skip to content

Commit c4e70a2

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix crash in openssl_pkey_get_details() when BIO_new() fails Fix error check on X509V3_EXT_print()
2 parents 4d544e4 + e474d3c commit c4e70a2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ext/openssl/openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ PHP_FUNCTION(openssl_x509_parse)
11481148
goto err_subitem;
11491149
}
11501150
}
1151-
else if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
1151+
else if (X509V3_EXT_print(bio_out, extension, 0, 0) > 0) {
11521152
BIO_get_mem_ptr(bio_out, &bio_buf);
11531153
add_assoc_stringl(&subitem, extname, bio_buf->data, bio_buf->length);
11541154
} else {
@@ -2308,7 +2308,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
23082308
EVP_PKEY *pkey = Z_OPENSSL_PKEY_P(key)->pkey;
23092309

23102310
BIO *out = BIO_new(BIO_s_mem());
2311-
if (!PEM_write_bio_PUBKEY(out, pkey)) {
2311+
if (!out || !PEM_write_bio_PUBKEY(out, pkey)) {
23122312
BIO_free(out);
23132313
php_openssl_store_errors();
23142314
RETURN_FALSE;

0 commit comments

Comments
 (0)