Skip to content

Commit 1089896

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

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/openssl/openssl_backend_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ zend_result php_openssl_load_rand_file(const char * file, int *egdsocket, int *s
440440
return SUCCESS;
441441
#endif
442442
}
443-
if (file == NULL || !RAND_load_file(file, -1)) {
443+
if (file == NULL || RAND_load_file(file, -1) < 0) {
444444
if (RAND_status() == 0) {
445445
php_openssl_store_errors();
446446
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
465465
if (file == NULL) {
466466
file = RAND_file_name(buffer, sizeof(buffer));
467467
}
468-
if (file == NULL || !RAND_write_file(file)) {
468+
if (file == NULL || RAND_write_file(file) < 0) {
469469
php_openssl_store_errors();
470470
php_error_docref(NULL, E_WARNING, "Unable to write random state");
471471
return FAILURE;

0 commit comments

Comments
 (0)