Skip to content

Commit 0b1a41a

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 d742e11 commit 0b1a41a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ext/openssl/openssl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7939,11 +7939,10 @@ PHP_OPENSSL_API zend_string* php_openssl_random_pseudo_bytes(zend_long buffer_le
79397939
PHP_OPENSSL_CHECK_LONG_TO_INT_NULL_RETURN(buffer_length, length);
79407940
PHP_OPENSSL_RAND_ADD_TIME();
79417941
if (RAND_bytes((unsigned char*)ZSTR_VAL(buffer), (int)buffer_length) <= 0) {
7942+
php_openssl_store_errors();
79427943
zend_string_release_ex(buffer, 0);
79437944
zend_throw_exception(zend_ce_exception, "Error reading from source device", 0);
79447945
return NULL;
7945-
} else {
7946-
php_openssl_store_errors();
79477946
}
79487947

79497948
return buffer;

0 commit comments

Comments
 (0)