mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix GH-9339: OpenSSL oid_file path check warning contains uninitialized path
This commit is contained in:
parent
7c6316ad1c
commit
84dcf578b1
3 changed files with 32 additions and 3 deletions
4
NEWS
4
NEWS
|
@ -20,6 +20,10 @@ PHP NEWS
|
|||
. Fixed bug GH-9033 (Loading blacklist file can fail due to negative length).
|
||||
(cmb)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug GH-9339 (OpenSSL oid_file path check warning contains
|
||||
uninitialized path). (Jakub Zelenka)
|
||||
|
||||
- PDO_SQLite:
|
||||
. Fixed bug GH-9032 (SQLite3 authorizer crashes on NULL values). (cmb)
|
||||
|
||||
|
|
|
@ -506,15 +506,15 @@ static bool php_openssl_check_path_ex(
|
|||
error_msg = "must not contain any null bytes";
|
||||
error_type = E_ERROR;
|
||||
} else if (expand_filepath(fs_file_path, real_path) == NULL) {
|
||||
error_msg = "The argument must be a valid file path";
|
||||
error_msg = "must be a valid file path";
|
||||
}
|
||||
|
||||
if (error_msg != NULL) {
|
||||
if (arg_num == 0) {
|
||||
const char *option_title = option_name ? option_name : "unknown";
|
||||
const char *option_label = is_from_array ? "array item" : "option";
|
||||
php_error_docref(NULL, E_WARNING, "Path '%s' for %s %s %s",
|
||||
real_path, option_title, option_label, error_msg);
|
||||
php_error_docref(NULL, E_WARNING, "Path for %s %s %s",
|
||||
option_title, option_label, error_msg);
|
||||
} else if (is_from_array && option_name != NULL) {
|
||||
php_openssl_check_path_error(
|
||||
arg_num, error_type, "option %s array item %s", option_name, error_msg);
|
||||
|
|
25
ext/openssl/tests/gh9339.phpt
Normal file
25
ext/openssl/tests/gh9339.phpt
Normal file
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
GH-9339: oid_file path check warning contains uninitialized path
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$configCode = <<<CONFIG
|
||||
oid_file = %s
|
||||
[ req ]
|
||||
default_bits = 1024
|
||||
CONFIG;
|
||||
|
||||
$configFile = __DIR__ . '/gh9339.cnf';
|
||||
file_put_contents($configFile, sprintf($configCode, __DIR__ . '/' . str_repeat('a', 9000)));
|
||||
openssl_pkey_new([ 'config' => $configFile ]);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/gh9339.cnf');
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Warning: openssl_pkey_new(): Path for oid_file option must be a valid file path in %s on line %d
|
Loading…
Add table
Add a link
Reference in a new issue