Skip to content

Segfault when bad type SNI_server_cert passed in #20802

@dixyes

Description

@dixyes

Description

server:

<?php

$context = stream_context_create([
    'ssl' => [
        'SNI_enabled' => true,
        'SNI_server_certs' => [
            'localhost' => false, // not a string/array
        ],
    ],
]);

$stream = stream_socket_server('tls://0.0.0.0:12443', $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context);

$conn = stream_socket_accept($stream);

connect with:

openssl s_client -debug 127.0.0.1:12443

missing check here:

php-src/ext/openssl/xp_ssl.c

Lines 1435 to 1437 in 434b14e

} else if (php_openssl_check_path_str_ex(
Z_STR_P(current), resolved_path_buff, 0, false, false,
"SNI_server_certs in ssl stream context")) {

PHP Version

master

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions