From 3762dba4084207aa5e1d7d8dfedc86c4e40adf92 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 29 Sep 2017 15:35:12 +0200 Subject: [PATCH] Fix rcube_utils::random_bytes() to not throw exception for length=0 --- program/lib/Roundcube/rcube_utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index 3bb244079cf..c8f8c664f91 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -1167,7 +1167,7 @@ public static function random_bytes($length, $raw = false) $random = openssl_random_pseudo_bytes($length); - if ($random === false) { + if ($random === false && $length > 0) { throw new Exception("Failed to get random bytes"); }