Skip to content

Commit 2c970a5

Browse files
committed
- Fixed NULL pointer dereference in stream_socket_enable_crypto, case when
ssl_handle of session_stream is not initialized.
1 parent 9a03ce5 commit 2c970a5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ext/openssl/xp_ssl.c

+2
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
406406
if (cparam->inputs.session) {
407407
if (cparam->inputs.session->ops != &php_openssl_socket_ops) {
408408
php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied session stream must be an SSL enabled stream");
409+
} else if (((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle == NULL) {
410+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied SSL session stream is not initialized");
409411
} else {
410412
SSL_copy_session_id(sslsock->ssl_handle, ((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle);
411413
}

0 commit comments

Comments
 (0)