X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fparagonie%2Frandom_compat%2Flib%2Frandom_bytes_mcrypt.php;h=f427694f54282301453c1525203cd3d04c530249;hb=4e1bfbf98b844da83b18aca92ef00f11a4735806;hp=aac9c013d4d71037eca77fce585efad4e14d84dc;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php index aac9c013d..f427694f5 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -42,6 +42,7 @@ if (!is_callable('random_bytes')) { function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -55,10 +56,11 @@ if (!is_callable('random_bytes')) { ); } - $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM); + /** @var string|bool $buf */ + $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); if ( - $buf !== false - && + is_string($buf) + && RandomCompat_strlen($buf) === $bytes ) { /**