Skip to content

Commit 096d7b8

Browse files
Address latest comment
1 parent f666ce6 commit 096d7b8

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ PHP NEWS
2828

2929
- OpenSSL:
3030
. Fix a bunch of memory leaks and crashes on edge cases. (ndossche)
31+
. Fixed bug GH-18988 (Check various unchecked error-prone OpenSSL function
32+
return values). (alexandre-daubois)
3133

3234
- SPL:
3335
. Fixed bug GH-21499 (RecursiveArrayIterator getChildren UAF after parent

ext/openssl/openssl.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,6 @@ PHP_MINIT_FUNCTION(openssl)
13031303
#endif
13041304
if (OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL) != 1) {
13051305
php_error_docref(NULL, E_WARNING, "Failed to initialize OpenSSL");
1306-
return FAILURE;
13071306
}
13081307
#endif
13091308

@@ -2330,10 +2329,7 @@ static STACK_OF(X509) *php_openssl_load_all_certs_from_file(
23302329
while (sk_X509_INFO_num(sk)) {
23312330
xi=sk_X509_INFO_shift(sk);
23322331
if (xi->x509 != NULL) {
2333-
if (sk_X509_push(stack,xi->x509) == 0) {
2334-
php_openssl_store_errors();
2335-
X509_free(xi->x509);
2336-
}
2332+
sk_X509_push(stack,xi->x509);
23372333
xi->x509=NULL;
23382334
}
23392335
X509_INFO_free(xi);

ext/openssl/xp_ssl.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,9 +1851,8 @@ static zend_result php_openssl_setup_crypto(php_stream *stream,
18511851
php_error_docref(NULL, E_WARNING, "Supplied session stream must be an SSL enabled stream");
18521852
} else if (((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle == NULL) {
18531853
php_error_docref(NULL, E_WARNING, "Supplied SSL session stream is not initialized");
1854-
} else if (SSL_copy_session_id(sslsock->ssl_handle, ((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle) != 1) {
1855-
php_openssl_store_errors();
1856-
php_error_docref(NULL, E_WARNING, "Failed to copy SSL session");
1854+
} else {
1855+
SSL_copy_session_id(sslsock->ssl_handle, ((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle);
18571856
}
18581857
}
18591858

0 commit comments

Comments
 (0)