Skip to content

OpenSSL oid_file path check warning contains uninitialized path #9339

@bukka

Description

@bukka

Description

Due to bug in the error message creation that is used in oid_file check, the uninitialized real_path is printed. It doesn't really make much sense to print the path as the invalid one is either too long or contains \0 character

The following code:

<?php
$configFile = __DIR__ . '/custom.cnf';
file_put_contents($configFile, sprintf("oid_file = %s\n",  __DIR__ . '/' . str_repeat('a', 9000)));
$pkey = openssl_pkey_new([ 'config' => $configFile ]);

Resulted in this output:

PHP Warning:  openssl_pkey_new(): Path '�h,�' for oid_file option must be a valid file path in ...

But I expected this output instead:

PHP Warning:  openssl_pkey_new(): Path for oid_file option must be a valid file path in ...

PHP Version

PHP 8.0

Operating System

Linux

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