com php-src: Fixed segfault when built with OpenSSL >= 1.0.1: ext/openssl/openssl.c

From: Date: Wed, 09 Oct 2013 07:17:25 +0000
Subject: com php-src: Fixed segfault when built with OpenSSL >= 1.0.1: ext/openssl/openssl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73404@lists.php.net to get a copy of this message
Commit: b026993a74f452c5f6a689124b4ad4d7b3ac2491 Author: Daniel Lowrey <rdlowrey@gmail.com> Mon, 7 Oct 2013 15:02:48 -0400 Committer: Michael Wallner <mike@php.net> Wed, 9 Oct 2013 09:17:25 +0200 Parents: b5a0f128718d93a236b450bb9b409477f0a97888 Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b026993a74f452c5f6a689124b4ad4d7b3ac2491 Log: Fixed segfault when built with OpenSSL >= 1.0.1 (PR #481) Bugs: https://bugs.php.net/481 Changed paths: M ext/openssl/openssl.c Diff: diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index f1dfa50..a2cdfb5 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -4613,9 +4613,6 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ GET_VER_OPT_STRING("local_cert", certfile); if (certfile) { - X509 *cert = NULL; - EVP_PKEY *key = NULL; - SSL *tmpssl; char resolved_path_buff[MAXPATHLEN]; const char * private_key = NULL; @@ -4642,7 +4639,11 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ } } - tmpssl = SSL_new(ctx); +#if OPENSSL_VERSION_NUMBER < 0x10001001L + /* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */ + X509 *cert = NULL; + EVP_PKEY *key = NULL; + SSL *tmpssl = SSL_new(ctx); cert = SSL_get_certificate(tmpssl); if (cert) { @@ -4651,7 +4652,7 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ EVP_PKEY_free(key); } SSL_free(tmpssl); - +#endif if (!SSL_CTX_check_private_key(ctx)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!"); }

« previous php.cvs (#73404) next »