diff --git a/ext/random/engine_pcgoneseq128xslrr64.c b/ext/random/engine_pcgoneseq128xslrr64.c index ccbe146321e..b19aff7e987 100644 --- a/ext/random/engine_pcgoneseq128xslrr64.c +++ b/ext/random/engine_pcgoneseq128xslrr64.c @@ -153,7 +153,7 @@ PHP_METHOD(Random_Engine_PcgOneseq128XslRr64, __construct) ZEND_PARSE_PARAMETERS_END(); if (seed_is_null) { - if (php_random_bytes_throw(&state->state, sizeof(php_random_uint128_t)) == FAILURE) { + if (php_random_bytes_throw(&state->state, sizeof(state->state)) == FAILURE) { zend_throw_exception(random_ce_Random_RandomException, "Failed to generate a random seed", 0); RETURN_THROWS(); } diff --git a/ext/random/engine_xoshiro256starstar.c b/ext/random/engine_xoshiro256starstar.c index 78cafe341c3..5d4dad08a14 100644 --- a/ext/random/engine_xoshiro256starstar.c +++ b/ext/random/engine_xoshiro256starstar.c @@ -213,7 +213,7 @@ PHP_METHOD(Random_Engine_Xoshiro256StarStar, __construct) if (seed_is_null) { do { - if (php_random_bytes_throw(&state->state, 32) == FAILURE) { + if (php_random_bytes_throw(&state->state, sizeof(state->state)) == FAILURE) { zend_throw_exception(random_ce_Random_RandomException, "Failed to generate a random seed", 0); RETURN_THROWS(); }