Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/random/engine_mt19937.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ PHPAPI void php_random_mt19937_seed_default(php_random_status_state_mt19937 *sta
{
zend_long seed = 0;

if (php_random_bytes_silent(&seed, sizeof(zend_long)) == FAILURE) {
if (php_random_bytes_silent(&seed, sizeof(seed)) == FAILURE) {
seed = GENERATE_SEED();
}

Expand Down Expand Up @@ -277,7 +277,7 @@ PHP_METHOD(Random_Engine_Mt19937, __construct)

if (seed_is_null) {
/* MT19937 has a very large state, uses CSPRNG for seeding only */
if (php_random_bytes_throw(&seed, sizeof(zend_long)) == FAILURE) {
if (php_random_bytes_throw(&seed, sizeof(seed)) == FAILURE) {
zend_throw_exception(random_ce_Random_RandomException, "Failed to generate a random seed", 0);
RETURN_THROWS();
}
Expand Down
2 changes: 1 addition & 1 deletion ext/random/engine_secure.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static php_random_result generate(php_random_status *status)
{
zend_ulong r = 0;

php_random_bytes_throw(&r, sizeof(zend_ulong));
php_random_bytes_throw(&r, sizeof(r));

return (php_random_result){
.size = sizeof(zend_ulong),
Expand Down