From 417e2fc2bb64bd869886a1549d0e7dc860d1cbcf Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 12 May 2009 09:07:18 +0000 Subject: - Patch #399248 by deekayen: detect when a signature is too long to prevent SQL errors. --- modules/user/user.module | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/user/user.module') diff --git a/modules/user/user.module b/modules/user/user.module index 0611c53e6..d15bfcdee 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -961,6 +961,15 @@ function user_user_validate(&$edit, &$account, $category = NULL) { form_set_error('mail', t('The e-mail address %email is already registered. Have you forgotten your password?', array('%email' => $edit['mail'], '@password' => url('user/password')))); } } + + // Make sure the signature isn't longer than the size of the database field. + // Signatures are disabled by default, so make sure it exists first. + if (isset($edit['signature'])) { + $user_schema = drupal_get_schema('users'); + if (strlen($edit['signature']) > $user_schema['fields']['signature']['length']) { + form_set_error('signature', t('The signature is too long: it must be %max characters or less.', array('%max' => $user_schema['fields']['signature']['length']))); + } + } } } -- cgit v1.2.3