Skip to content

Commit f938f35

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-18986: OpenSSL backend: incorrect RAND_{load,write}_file() return value check
2 parents 3d468a1 + a8086be commit f938f35

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

NEWS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.4.12
44

5-
5+
- OpenSSL:
6+
. Fixed bug GH-18986 (OpenSSL backend: incorrect RAND_{load,write}_file()
7+
return value check). (nielsdos, botovq)
68

79
31 Jul 2025, PHP 8.4.11
810

ext/openssl/openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *se
11131113
return SUCCESS;
11141114
#endif
11151115
}
1116-
if (file == NULL || !RAND_load_file(file, -1)) {
1116+
if (file == NULL || RAND_load_file(file, -1) < 0) {
11171117
if (RAND_status() == 0) {
11181118
php_openssl_store_errors();
11191119
php_error_docref(NULL, E_WARNING, "Unable to load random state; not enough random data!");
@@ -1140,7 +1140,7 @@ static int php_openssl_write_rand_file(const char * file, int egdsocket, int see
11401140
file = RAND_file_name(buffer, sizeof(buffer));
11411141
}
11421142
PHP_OPENSSL_RAND_ADD_TIME();
1143-
if (file == NULL || !RAND_write_file(file)) {
1143+
if (file == NULL || RAND_write_file(file) < 0) {
11441144
php_openssl_store_errors();
11451145
php_error_docref(NULL, E_WARNING, "Unable to write random state");
11461146
return FAILURE;

0 commit comments

Comments
 (0)