Skip to content

Commit 5e68671

Browse files
committed
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.
1 parent 0dc600c commit 5e68671

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Diff for: ext/openssl/openssl.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -7940,11 +7940,10 @@ PHP_OPENSSL_API zend_string* php_openssl_random_pseudo_bytes(zend_long buffer_le
79407940
PHP_OPENSSL_CHECK_LONG_TO_INT_NULL_RETURN(buffer_length, length);
79417941
PHP_OPENSSL_RAND_ADD_TIME();
79427942
if (RAND_bytes((unsigned char*)ZSTR_VAL(buffer), (int)buffer_length) <= 0) {
7943+
php_openssl_store_errors();
79437944
zend_string_release_ex(buffer, 0);
79447945
zend_throw_exception(zend_ce_exception, "Error reading from source device", 0);
79457946
return NULL;
7946-
} else {
7947-
php_openssl_store_errors();
79487947
}
79497948

79507949
return buffer;

0 commit comments

Comments
 (0)