]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1202447: [SECURITY] The email address is not properly validated during registrati...
authorByron Jones ‹:glob› <glob@mozilla.com>
Thu, 10 Sep 2015 17:25:01 +0000 (13:25 -0400)
committerDavid Lawrence <dkl@mozilla.com>
Thu, 10 Sep 2015 17:25:01 +0000 (13:25 -0400)
r=LpSolit,a=justdave

Bugzilla/Util.pm

index 48507ff9e73005b679a3cbd70cb7238a6a034d94..5cf347ab2084bfbcf1fdef1ef6506e44d7f694a5 100644 (file)
@@ -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 {