Skip to content

Commit fc55723

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

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
@@ -1152,7 +1152,7 @@ PHP_FUNCTION(openssl_x509_parse)
11521152
goto err_subitem;
11531153
}
11541154
}
1155-
else if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
1155+
else if (X509V3_EXT_print(bio_out, extension, 0, 0) > 0) {
11561156
BIO_get_mem_ptr(bio_out, &bio_buf);
11571157
add_assoc_stringl(&subitem, extname, bio_buf->data, bio_buf->length);
11581158
} else {
@@ -2326,7 +2326,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
23262326
EVP_PKEY *pkey = Z_OPENSSL_PKEY_P(key)->pkey;
23272327

23282328
BIO *out = BIO_new(BIO_s_mem());
2329-
if (!PEM_write_bio_PUBKEY(out, pkey)) {
2329+
if (!out || !PEM_write_bio_PUBKEY(out, pkey)) {
23302330
BIO_free(out);
23312331
php_openssl_store_errors();
23322332
RETURN_FALSE;

0 commit comments

Comments
 (0)