From: Byron Jones ‹:glob› Date: Thu, 10 Sep 2015 17:25:01 +0000 (-0400) Subject: Bug 1202447: [SECURITY] The email address is not properly validated during registrati... X-Git-Tag: bugzilla-4.2.15~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10b1fef73989f72777bc5ea3ef5bdcd78dce279b;p=thirdparty%2Fbugzilla.git Bug 1202447: [SECURITY] The email address is not properly validated during registration if longer than 127 characters r=LpSolit,a=justdave --- 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 {