mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-25 11:20:03 +00:00
Fix logic error reading random bytes from /dev/urandom
Fixes a bug introduced in c2be7e648
Previously, this would return those bytes if the number of bytes read
was **less than** the number of bytes this was trying to read.
In practice, I believe this would mean bytes from /dev/urandom would never
get used. (Noticed when upgrading phpseclib)
This commit is contained in:
parent
5e2951f83a
commit
41eb0d8012
@ -106,7 +106,7 @@ if (!function_exists('crypt_random_string')) {
|
||||
}
|
||||
if ($fp !== true && $fp !== false) { // surprisingly faster than !is_bool() or is_resource()
|
||||
$temp = fread($fp, $length);
|
||||
if (strlen($temp) != $length) {
|
||||
if (strlen($temp) == $length) {
|
||||
return $temp;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user