From 10b1fef73989f72777bc5ea3ef5bdcd78dce279b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Byron=20Jones=20=E2=80=B9=3Aglob=E2=80=BA?= Date: Thu, 10 Sep 2015 13:25:01 -0400 Subject: [PATCH] Bug 1202447: [SECURITY] The email address is not properly validated during registration if longer than 127 characters r=LpSolit,a=justdave --- Bugzilla/Util.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 48507ff9e7..5cf347ab20 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -652,12 +652,17 @@ sub generate_random_password { sub validate_email_syntax { my ($addr) = @_; my $match = Bugzilla->params->{'emailregexp'}; - my $ret = ($addr =~ /$match/ && $addr !~ /[\\\(\)<>&,;:"\[\] \t\r\n\P{ASCII}]/); - if ($ret) { + # We set the max length to 127 to ensure addresses aren't truncated when + # inserted into the tokens.eventdata field. + if ($addr =~ /$match/ + && $addr !~ /[\\\(\)<>&,;:"\[\] \t\r\n\P{ASCII}]/ + && length($addr) <= 127) + { # We assume these checks to suffice to consider the address untainted. trick_taint($_[0]); + return 1; } - return $ret ? 1 : 0; + return 0; } sub validate_date { -- 2.47.2