Skip to content

Commit 8a927c2

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix potential leaks when writing to BIO fails
2 parents 14853ea + 29f96fb commit 8a927c2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ PHP NEWS
3232
- OpenSSL:
3333
. Fix memory leak in openssl_sign() when passing invalid algorithm.
3434
(nielsdos)
35+
. Fix potential leaks when writing to BIO fails. (nielsdos)
3536

3637
- Standard:
3738
. Fixed bug GH-18145 (php8ts crashes in php_clear_stat_cache()).

ext/openssl/openssl.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -5945,8 +5945,8 @@ PHP_FUNCTION(openssl_pkcs7_read)
59455945
BIO_get_mem_ptr(bio_out, &bio_buf);
59465946
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
59475947
add_index_zval(zout, i, &zcert);
5948-
BIO_free(bio_out);
59495948
}
5949+
BIO_free(bio_out);
59505950
}
59515951
}
59525952

@@ -5960,8 +5960,8 @@ PHP_FUNCTION(openssl_pkcs7_read)
59605960
BIO_get_mem_ptr(bio_out, &bio_buf);
59615961
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
59625962
add_index_zval(zout, i, &zcert);
5963-
BIO_free(bio_out);
59645963
}
5964+
BIO_free(bio_out);
59655965
}
59665966
}
59675967

@@ -6586,8 +6586,8 @@ PHP_FUNCTION(openssl_cms_read)
65866586
BIO_get_mem_ptr(bio_out, &bio_buf);
65876587
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
65886588
add_index_zval(zout, i, &zcert);
6589-
BIO_free(bio_out);
65906589
}
6590+
BIO_free(bio_out);
65916591
}
65926592
}
65936593

@@ -6601,8 +6601,8 @@ PHP_FUNCTION(openssl_cms_read)
66016601
BIO_get_mem_ptr(bio_out, &bio_buf);
66026602
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
66036603
add_index_zval(zout, i, &zcert);
6604-
BIO_free(bio_out);
66056604
}
6605+
BIO_free(bio_out);
66066606
}
66076607
}
66086608

0 commit comments

Comments
 (0)