From aba0927545d3bd9998cbcf6bbc2a0b6bfd8d0318 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 3 Mar 2010 12:12:31 +0000 Subject: - Fix long e-mail addresses validation (#1486453) --- program/include/main.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'program') diff --git a/program/include/main.inc b/program/include/main.inc index 9cf6dd00c..da588b240 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1511,8 +1511,12 @@ function check_email($email) if (preg_match('/[\x00-\x1F\x7F-\xFF]/', $email)) return false; - // Check that there's one @ symbol, and that the lengths are right - if (!preg_match('/^([^@]{1,64})@([^@]{1,255})$/', $email, $email_array)) + // Check for length limit specified by RFC 5321 (#1486453) + if (strlen($email) > 254) + return false; + + // Check that there's one @ symbol + if (!preg_match('/^([^@]+)@([^@]+)$/', $email, $email_array)) return false; // Check local part -- cgit v1.2.3