From: Byron Jones ‹:glob› Date: Thu, 10 Sep 2015 17:27:44 +0000 (-0400) Subject: Bug 1202447: [SECURITY] The email address is not properly validated during registrati... X-Git-Tag: bugzilla-4.4.10~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be1be8cbe100a43c51984c1792151c314c65244f;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 4bd10e16c5..527bae85a8 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -681,12 +681,18 @@ sub validate_email_syntax { # RFC 2822 section 2.1 specifies that email addresses must # be made of US-ASCII characters only. # Email::Address::addr_spec doesn't enforce this. - my $ret = ($addr =~ /$match/ && $email !~ /\P{ASCII}/ && $email =~ /^$addr_spec$/); - 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/ + && $email !~ /\P{ASCII}/ + && $email =~ /^$addr_spec$/ + && length($email) <= 127) + { # We assume these checks to suffice to consider the address untainted. trick_taint($_[0]); + return 1; } - return $ret ? 1 : 0; + return 0; } sub check_email_syntax {