diff options
author | lysenkobv <lysenkobv@gmail.com> | 2012-10-10 19:11:34 +0200 |
---|---|---|
committer | lysenkobv <lysenkobv@gmail.com> | 2012-10-10 19:11:34 +0200 |
commit | c6f9a5da098ed9e27d88b7c271c4e1ba76fa79d6 (patch) | |
tree | 11f6376dee588d4e5215ab98734482ce08030d33 | |
parent | 6d9915a7a82ff3f7e9dc0f4969764788cf005f36 (diff) |
libraries/Encrypt.php decode improvement
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
-rw-r--r-- | system/libraries/Encrypt.php | 2 |
1 files changed, 1 insertions, 1 deletions
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; } |