diff options
author | Xinchen Hui <laruence@php.net> | 2015-02-16 14:16:52 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2015-02-16 14:16:52 +0800 |
commit | 830998811112d60a9fe98c7e2b86250ccf75d6f4 (patch) | |
tree | 63c04447ad076276a03e39b15cbf29531e47d44d | |
parent | 423a057023ef3c00d2ffc16a6b43ba01d0f71796 (diff) | |
download | php-git-830998811112d60a9fe98c7e2b86250ccf75d6f4.tar.gz |
Fixed bug #68912 (Segmentation fault at openssl_spki_new)
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/openssl/openssl.c | 2 | ||||
-rw-r--r-- | ext/openssl/tests/bug68912.phpt | 20 |
3 files changed, 23 insertions, 2 deletions
@@ -9,7 +9,8 @@ . Bug #68964 (Allowed memory size exhausted with odbc_exec). (Anatol) - OpenSSL: - . Fix bug #61285, #68329, #68046, #41631: encrypted streams don't observe + . Fixed bug #68912 (Segmentation fault at openssl_spki_new). (Laruence) + . Fixed bug #61285, #68329, #68046, #41631: encrypted streams don't observe socket timeouts (Brad Broerman) - pgsql: diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 655d7f6eb4..5538ef76da 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1532,7 +1532,7 @@ cleanup: efree(spkstr); } - if (strlen(s) <= 0) { + if (s && strlen(s) <= 0) { RETVAL_FALSE; } diff --git a/ext/openssl/tests/bug68912.phpt b/ext/openssl/tests/bug68912.phpt new file mode 100644 index 0000000000..7d763db8e9 --- /dev/null +++ b/ext/openssl/tests/bug68912.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #68912 (Segmentation fault at openssl_spki_new) +--SKIPIF-- +<?php +if (!extension_loaded("openssl")) die("skip"); +if (!@openssl_pkey_new()) die("skip cannot create private key"); +?> +--FILE-- +<?php + +$var1=xml_parser_create_ns(); +$var2=2; +$var3=3; + +openssl_spki_new($var1, $var2, $var3); +?> +--EXPECTF-- +Warning: openssl_spki_new(): supplied resource is not a valid OpenSSL X.509/key resource in %sbug68912.php on line %d + +Warning: openssl_spki_new(): Unable to use supplied private key in %sbug68912.php on line %d |