Commit c3a7e7b5 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch 'cherry-pick-697eff83' into '1.2.1-fixes'

Merge branch '5843-security-insecure-generation-of-random-tokens' into '1.2.1-fixes'

See merge request fusiondirectory/fd!323
Showing with 1 addition and 1 deletion
+1 -1
...@@ -2663,7 +2663,7 @@ if (!function_exists('random_int')) { ...@@ -2663,7 +2663,7 @@ if (!function_exists('random_int')) {
if (!$strong || ($randomBytes === FALSE)) { if (!$strong || ($randomBytes === FALSE)) {
throw new Exception('Failed to get random bytes'); throw new Exception('Failed to get random bytes');
} }
$rnd = unpack('Q', $randomBytes)[1]; $rnd = unpack('L', $randomBytes)[1];
// discard irrelevant bits // discard irrelevant bits
$rnd = $rnd & $filter; $rnd = $rnd & $filter;
} while ($rnd >= $range); } while ($rnd >= $range);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment