From c6f9a5da098ed9e27d88b7c271c4e1ba76fa79d6 Mon Sep 17 00:00:00 2001 From: lysenkobv Date: Wed, 10 Oct 2012 20:11:34 +0300 Subject: libraries/Encrypt.php decode improvement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if base64 string is NO valid the result of decoded string is something like this "23Y�����������S�� �����i��!q" (base64_encode(base64_decode($string)) !== $string) check is this base64 string valid --- system/libraries/Encrypt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 679609251..dbe16b096 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -165,7 +165,7 @@ class CI_Encrypt { */ public function decode($string, $key = '') { - if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string)) + if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string) || base64_encode(base64_decode($string)) !== $string) { return FALSE; } -- cgit v1.2.3-24-g4f1b