mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16357: openssl may modify member types of certificate arrays
This commit is contained in:
4
NEWS
4
NEWS
@@ -30,6 +30,10 @@ PHP NEWS
|
||||
. Fixed bug GH-16361 (mb_substr overflow on start/length arguments).
|
||||
(David Carlier)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug GH-16357 (openssl may modify member types of certificate arrays).
|
||||
(cmb)
|
||||
|
||||
- PHPDBG:
|
||||
. Fixed bug GH-16174 (Empty string is an invalid expression for ev). (cmb)
|
||||
|
||||
|
||||
@@ -1524,11 +1524,13 @@ static X509 *php_openssl_x509_from_zval(
|
||||
|
||||
*free_cert = 1;
|
||||
|
||||
if (!try_convert_to_string(val)) {
|
||||
zend_string *str = zval_try_get_string(val);
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return php_openssl_x509_from_str(Z_STR_P(val), arg_num, is_from_array, option_name);
|
||||
X509 *cert = php_openssl_x509_from_str(str, arg_num, is_from_array, option_name);
|
||||
zend_string_release(str);
|
||||
return cert;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
22
ext/openssl/tests/gh16357.phpt
Normal file
22
ext/openssl/tests/gh16357.phpt
Normal file
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
GH-16357 (openssl may modify member types of certificate arrays)
|
||||
--EXTENSIONS--
|
||||
openssl
|
||||
--FILE--
|
||||
<?php
|
||||
$infile = __DIR__ . "/cert.crt";
|
||||
$outfile = __DIR__ . "/gh16357.txt";
|
||||
$certs = [123];
|
||||
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $certs, null));
|
||||
var_dump($certs);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . "/gh16357.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(123)
|
||||
}
|
||||
Reference in New Issue
Block a user