mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
Merge branch 'PHP-8.1'
This commit is contained in:
commit
cb5d5d885c
@ -519,15 +519,15 @@ static bool php_openssl_check_path_ex(
|
|||||||
error_msg = "must not contain any null bytes";
|
error_msg = "must not contain any null bytes";
|
||||||
error_type = E_ERROR;
|
error_type = E_ERROR;
|
||||||
} else if (expand_filepath(fs_file_path, real_path) == NULL) {
|
} 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 (error_msg != NULL) {
|
||||||
if (arg_num == 0) {
|
if (arg_num == 0) {
|
||||||
const char *option_title = option_name ? option_name : "unknown";
|
const char *option_title = option_name ? option_name : "unknown";
|
||||||
const char *option_label = is_from_array ? "array item" : "option";
|
const char *option_label = is_from_array ? "array item" : "option";
|
||||||
php_error_docref(NULL, E_WARNING, "Path '%s' for %s %s %s",
|
php_error_docref(NULL, E_WARNING, "Path for %s %s %s",
|
||||||
real_path, option_title, option_label, error_msg);
|
option_title, option_label, error_msg);
|
||||||
} else if (is_from_array && option_name != NULL) {
|
} else if (is_from_array && option_name != NULL) {
|
||||||
php_openssl_check_path_error(
|
php_openssl_check_path_error(
|
||||||
arg_num, error_type, "option %s array item %s", option_name, error_msg);
|
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…
Reference in New Issue
Block a user