Bug #73072 [NEW]: Invalid path SNI_server_certs causes segfault

From: Date: Tue, 13 Sep 2016 16:16:53 +0000
Subject: Bug #73072 [NEW]: Invalid path SNI_server_certs causes segfault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204008@lists.php.net to get a copy of this message
From: bukka Operating system: All PHP version: 5.6.25 Package: OpenSSL related Bug Type: Bug Bug description:Invalid path SNI_server_certs causes segfault Description: ------------ If the SNI_server_certs stream ssl option contains an invalid path, it causes segfault after the client connects. It is because the initializing loop is jumped off when error happens and keeps the sni_certs unitialized which causes later segfault when they are freed. Test script: --------------- $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN; $ctx = stream_context_create(['ssl' => [ 'local_cert' => __DIR__ . '/domain1.pem', 'SNI_server_certs' => [ "domain1.com" => __DIR__ . "/sni_server_domain1.pem", "domain2.com" => __DIR__ . "/unknown", ] ]]); $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx); for ($i=0; $i < 3; $i++) { @stream_socket_accept($server, 3); } Expected result: ---------------- Warning: failed setting local cert chain file `%s'; file not found Actual result: -------------- segfault -- Edit bug report at https://bugs.php.net/bug.php?id=73072&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73072&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73072&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73072&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73072&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73072&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73072&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73072&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73072&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73072&r=support Expected behavior: https://bugs.php.net/fix.php?id=73072&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73072&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73072&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73072&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73072&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73072&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73072&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73072&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73072&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73072&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73072&r=mysqlcfg

« previous php.bugs (#204008) next »