mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix inverted call to php_openssl_store_errors() Fix openssl_random_pseudo_bytes() always setting strong_result to true
This commit is contained in:
commit
a6e76ac010
1 changed files with 6 additions and 9 deletions
|
@ -8157,11 +8157,10 @@ PHP_OPENSSL_API zend_string* php_openssl_random_pseudo_bytes(zend_long buffer_le
|
|||
PHP_OPENSSL_CHECK_LONG_TO_INT_NULL_RETURN(buffer_length, length);
|
||||
PHP_OPENSSL_RAND_ADD_TIME();
|
||||
if (RAND_bytes((unsigned char*)ZSTR_VAL(buffer), (int)buffer_length) <= 0) {
|
||||
php_openssl_store_errors();
|
||||
zend_string_release_ex(buffer, 0);
|
||||
zend_throw_exception(zend_ce_exception, "Error reading from source device", 0);
|
||||
return NULL;
|
||||
} else {
|
||||
php_openssl_store_errors();
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
@ -8178,17 +8177,15 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
|||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zstrong_result_returned) {
|
||||
ZEND_TRY_ASSIGN_REF_FALSE(zstrong_result_returned);
|
||||
}
|
||||
|
||||
if ((buffer = php_openssl_random_pseudo_bytes(buffer_length))) {
|
||||
ZSTR_VAL(buffer)[buffer_length] = 0;
|
||||
RETVAL_NEW_STR(buffer);
|
||||
}
|
||||
|
||||
if (zstrong_result_returned) {
|
||||
ZEND_TRY_ASSIGN_REF_TRUE(zstrong_result_returned);
|
||||
if (zstrong_result_returned) {
|
||||
ZEND_TRY_ASSIGN_REF_TRUE(zstrong_result_returned);
|
||||
}
|
||||
} else if (zstrong_result_returned) {
|
||||
ZEND_TRY_ASSIGN_REF_FALSE(zstrong_result_returned);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue