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

Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix GH-18986: OpenSSL backend: incorrect RAND_{load,write}_file() return value check
This commit is contained in:
Niels Dossche
2025-07-15 18:52:56 +02:00

View File

@@ -440,7 +440,7 @@ zend_result php_openssl_load_rand_file(const char * file, int *egdsocket, int *s
return SUCCESS;
#endif
}
if (file == NULL || !RAND_load_file(file, -1)) {
if (file == NULL || RAND_load_file(file, -1) < 0) {
if (RAND_status() == 0) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "Unable to load random state; not enough random data!");
@@ -465,7 +465,7 @@ zend_result php_openssl_write_rand_file(const char * file, int egdsocket, int se
if (file == NULL) {
file = RAND_file_name(buffer, sizeof(buffer));
}
if (file == NULL || !RAND_write_file(file)) {
if (file == NULL || RAND_write_file(file) < 0) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "Unable to write random state");
return FAILURE;