php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52947 segfault when ssl stream option capture_peer_cert_chain used
Submitted: 2010-09-28 22:42 UTC Modified: 2010-09-29 03:26 UTC
From: blacklight332 at aol dot com Assigned: felipe (profile)
Status: Closed Package: Streams related
PHP Version: 5.3.3 OS: Ubuntu Linux 10.10 beta
Private report: No CVE-ID: None
 [2010-09-28 22:42 UTC] blacklight332 at aol dot com
Description:
------------
Bug http://bugs.php.net/bug.php?id=52945 says that the ssl stream context option capture_peer_chain (http://www.php.net/manual/en/context.ssl.php) was really implemented as capture_peer_cert_chain in the php project source code.

Once this fact is realized, then I tried to use the option capture_peer_cert_chain in an ssl stream context connection, and it segfaults when I do a var_dump.






Test script:
---------------
$o = array("capture_peer_cert" => true,"capture_peer_cert_chain" => true,);
$g = stream_context_create (array("ssl" => $o));
$r = stream_socket_client("ssl://www.digicert.com:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $g);
$cont = stream_context_get_params($r);
var_dump($cont['options']['ssl']);

Expected result:
----------------
array(4) {
  ["capture_peer_cert"]=>
  bool(true)
  ["capture_peer_cert_chain"]=>
  bool(true)
  ["peer_certificate"]=>
  resource(6) of type (OpenSSL X.509)
  ["peer_certificate_chain"]
  -something other than a segfault-
}

--------------------
I hope the "peer_certificate_chain" would be an array of "resource(6) of type (OpenSSL X.509)" but I'm not sure if that is the intended behavior or not.


Actual result:
--------------
array(4) {
  ["capture_peer_cert"]=>
  bool(true)
  ["capture_peer_cert_chain"]=>
  bool(true)
  ["peer_certificate"]=>
  resource(6) of type (OpenSSL X.509)
  ["peer_certificate_chain"]
  Segmentation fault (core dumped)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-29 03:25 UTC] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=303839
Log: - Fixed bug #52947 (segfault when ssl stream option capture_peer_cert_chain used)
 [2010-09-29 03:26 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-09-29 03:26 UTC] felipe@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC