1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix inverted call to php_openssl_store_errors()

This calls php_openssl_store_errors() in the success path right now,
change it to call php_openssl_store_errors() in the error path.
This commit is contained in:
Niels Dossche
2025-03-30 23:54:56 +02:00
parent 0dc600c69a
commit 5e68671f88

View File

@@ -7940,11 +7940,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;