summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--ext/openssl/openssl.c2
-rw-r--r--ext/openssl/tests/bug68912.phpt20
3 files changed, 23 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 23df097b87..86ebfd3f59 100644
--- a/NEWS
+++ b/NEWS
@@ -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