Skip to content

Commit f7be9cb

Browse files
authored
Limited decrypt to 256 characters in Mage_Core_Model_Encryption (#2685)
1 parent 04da476 commit f7be9cb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/code/core/Mage/Core/Model/Encryption.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ class Mage_Core_Model_Encryption
3737
*/
3838
public const HASH_VERSION_LATEST = 3;
3939

40+
/**
41+
* Maximum Password Length
42+
*/
43+
public const MAXIMUM_PASSWORD_LENGTH = 256;
44+
4045
/**
4146
* @var Varien_Crypt_Mcrypt
4247
*/
4348
protected $_crypt;
49+
4450
/**
4551
* @var Mage_Core_Helper_Data
4652
*/
@@ -126,6 +132,10 @@ public function hash($data, $version = self::HASH_VERSION_MD5)
126132
*/
127133
public function validateHash($password, $hash)
128134
{
135+
if (strlen($password) > self::MAXIMUM_PASSWORD_LENGTH) {
136+
return false;
137+
}
138+
129139
return $this->validateHashByVersion($password, $hash, self::HASH_VERSION_LATEST)
130140
|| $this->validateHashByVersion($password, $hash, self::HASH_VERSION_SHA512)
131141
|| $this->validateHashByVersion($password, $hash, self::HASH_VERSION_SHA256)

0 commit comments

Comments
 (0)