Skip to content

Commit 074ebc2

Browse files
author
Benjamin Doherty
committed
Merge remote-tracking branch 'drupal/7.x' into 7.x-symfony
2 parents e4febb7 + de8762b commit 074ebc2

File tree

6 files changed

+38
-6
lines changed

6 files changed

+38
-6
lines changed

CHANGELOG.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11

2-
Drupal 7.34, xxxx-xx-xx (development version)
2+
Drupal 7.35, xxxx-xx-xx (development version)
33
-----------------------
4+
- Fixed a bug in the Contact module which caused the global user object to have
5+
the incorrect name and e-mail address during the remainder of the page
6+
request after the contact form is submitted.
7+
8+
Drupal 7.34, 2014-11-19
9+
----------------------
10+
- Fixed security issues (multiple vulnerabilities). See SA-CORE-2014-006.
411

512
Drupal 7.33, 2014-11-07
613
-----------------------

includes/bootstrap.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* The current system version.
1010
*/
11-
define('VERSION', '7.34-dev');
11+
define('VERSION', '7.35-dev');
1212

1313
/**
1414
* Core API compatibility.

includes/password.inc

+5-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function _password_enforce_log2_boundaries($count_log2) {
140140
* @param $algo
141141
* The string name of a hashing algorithm usable by hash(), like 'sha256'.
142142
* @param $password
143-
* The plain-text password to hash.
143+
* Plain-text password up to 512 bytes (128 to 512 UTF-8 characters) to hash.
144144
* @param $setting
145145
* An existing hash or the output of _password_generate_salt(). Must be
146146
* at least 12 characters (the settings and salt).
@@ -150,6 +150,10 @@ function _password_enforce_log2_boundaries($count_log2) {
150150
* The return string will be truncated at DRUPAL_HASH_LENGTH characters max.
151151
*/
152152
function _password_crypt($algo, $password, $setting) {
153+
// Prevent DoS attacks by refusing to hash large passwords.
154+
if (strlen($password) > 512) {
155+
return FALSE;
156+
}
153157
// The first 12 characters of an existing hash are its setting string.
154158
$setting = substr($setting, 0, 12);
155159

includes/session.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function _drupal_session_read($sid) {
7979
// Handle the case of first time visitors and clients that don't store
8080
// cookies (eg. web crawlers).
8181
$insecure_session_name = substr(session_name(), 1);
82-
if (!isset($_COOKIE[session_name()]) && !isset($_COOKIE[$insecure_session_name])) {
82+
if (empty($sid) || (!isset($_COOKIE[session_name()]) && !isset($_COOKIE[$insecure_session_name]))) {
8383
$user = drupal_anonymous_user();
8484
return '';
8585
}

modules/contact/contact.pages.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function contact_site_form_submit($form, &$form_state) {
134134
global $user, $language;
135135

136136
$values = $form_state['values'];
137-
$values['sender'] = $user;
137+
$values['sender'] = clone $user;
138138
$values['sender']->name = $values['name'];
139139
$values['sender']->mail = $values['mail'];
140140
$values['category'] = contact_load($values['cid']);
@@ -270,7 +270,7 @@ function contact_personal_form_submit($form, &$form_state) {
270270
global $user, $language;
271271

272272
$values = $form_state['values'];
273-
$values['sender'] = $user;
273+
$values['sender'] = clone $user;
274274
$values['sender']->name = $values['name'];
275275
$values['sender']->mail = $values['mail'];
276276

modules/simpletest/tests/password.test

+21
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,25 @@ class PasswordHashingTest extends DrupalWebTestCase {
5757
$this->assertFalse(user_needs_new_hash($account), 'Re-hashed password does not need a new hash.');
5858
$this->assertTrue(user_check_password($password, $account), 'Password check succeeds with re-hashed password.');
5959
}
60+
61+
/**
62+
* Verifies that passwords longer than 512 bytes are not hashed.
63+
*/
64+
public function testLongPassword() {
65+
$password = str_repeat('x', 512);
66+
$result = user_hash_password($password);
67+
$this->assertFalse(empty($result), '512 byte long password is allowed.');
68+
$password = str_repeat('x', 513);
69+
$result = user_hash_password($password);
70+
$this->assertFalse($result, '513 byte long password is not allowed.');
71+
// Check a string of 3-byte UTF-8 characters.
72+
$password = str_repeat('€', 170);
73+
$result = user_hash_password($password);
74+
$this->assertFalse(empty($result), '510 byte long password is allowed.');
75+
$password .= 'xx';
76+
$this->assertFalse(empty($result), '512 byte long password is allowed.');
77+
$password = str_repeat('€', 171);
78+
$result = user_hash_password($password);
79+
$this->assertFalse($result, '513 byte long password is not allowed.');
80+
}
6081
}

0 commit comments

Comments
 (0)