Prevent high resource usage when hashing large passwords. props mdawaffe, pento
Built from https://develop.svn.wordpress.org/trunk@30466 git-svn-id: http://core.svn.wordpress.org/trunk@30457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
12b2ca45ad
commit
ccf39f33c9
|
@ -214,6 +214,10 @@ class PasswordHash {
|
||||||
|
|
||||||
function HashPassword($password)
|
function HashPassword($password)
|
||||||
{
|
{
|
||||||
|
if ( strlen( $password ) > 4096 ) {
|
||||||
|
return '*';
|
||||||
|
}
|
||||||
|
|
||||||
$random = '';
|
$random = '';
|
||||||
|
|
||||||
if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
|
if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
|
||||||
|
@ -249,6 +253,10 @@ class PasswordHash {
|
||||||
|
|
||||||
function CheckPassword($password, $stored_hash)
|
function CheckPassword($password, $stored_hash)
|
||||||
{
|
{
|
||||||
|
if ( strlen( $password ) > 4096 ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$hash = $this->crypt_private($password, $stored_hash);
|
$hash = $this->crypt_private($password, $stored_hash);
|
||||||
if ($hash[0] == '*')
|
if ($hash[0] == '*')
|
||||||
$hash = crypt($password, $stored_hash);
|
$hash = crypt($password, $stored_hash);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.1-beta1-30461';
|
$wp_version = '4.1-beta1-30466';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue