Added patch for stop a bug of bcrypt with null characters

This commit is contained in:
Antonio de la Rosa 2016-03-26 22:19:47 +01:00
parent 421a54bd3c
commit 16cd13edbc

View file

@ -55,6 +55,20 @@ class PasswordField extends CharField {
} }
//Fix for check bug with null password
//$value=str_replace("\x00", "\\x00", $value);
if(strpos($value, "\x00")!==false)
{
$this->error=1;
$this->std_error=I18n::lang('common', 'error_null_password', 'Bcrypt have problems using null characters...');
return '';
}
$hash_password=password_hash($value, PASSWORD_DEFAULT); $hash_password=password_hash($value, PASSWORD_DEFAULT);
return $hash_password; return $hash_password;