File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ PHP NEWS
3333 . Added workaround for SELinux mprotect execheap issue.
3434 See https://bugzilla.kernel.org/show_bug.cgi?id=218258. (ilutov)
3535
36+ - OpenSSL:
37+ . Fixed bug GH-12987 (openssl_csr_sign might leak new cert on error).
38+ (Jakub Zelenka)
39+
3640- PDO_ODBC:
3741 . Fixed bug GH-12767 (Unable to turn on autocommit mode with setAttribute()).
3842 (SakiTakamachi)
Original file line number Diff line number Diff line change @@ -3194,6 +3194,7 @@ PHP_FUNCTION(openssl_csr_sign)
31943194 X509 * cert = NULL , * new_cert = NULL ;
31953195 EVP_PKEY * key = NULL , * priv_key = NULL ;
31963196 int i ;
3197+ bool new_cert_used = false;
31973198 struct php_x509_request req ;
31983199
31993200 ZEND_PARSE_PARAMETERS_START (4 , 6 )
@@ -3315,11 +3316,12 @@ PHP_FUNCTION(openssl_csr_sign)
33153316 object_init_ex (return_value , php_openssl_certificate_ce );
33163317 cert_object = Z_OPENSSL_CERTIFICATE_P (return_value );
33173318 cert_object -> x509 = new_cert ;
3319+ new_cert_used = true;
33183320
33193321cleanup :
33203322
3321- if (cert == new_cert ) {
3322- cert = NULL ;
3323+ if (! new_cert_used && new_cert ) {
3324+ X509_free ( new_cert ) ;
33233325 }
33243326
33253327 PHP_SSL_REQ_DISPOSE (& req );
@@ -3328,7 +3330,7 @@ PHP_FUNCTION(openssl_csr_sign)
33283330 if (csr_str ) {
33293331 X509_REQ_free (csr );
33303332 }
3331- if (cert_str && cert ) {
3333+ if (cert_str && cert && cert != new_cert ) {
33323334 X509_free (cert );
33333335 }
33343336}
You can’t perform that action at this time.
0 commit comments