]> 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:36:24 +0000 (13:36 -0400)
committerDavid Lawrence <dkl@mozilla.com>
Thu, 10 Sep 2015 17:36:24 +0000 (13:36 -0400)
r=LpSolit,a=justdave

Bugzilla/Util.pm

index f0b38b0b0c67d387b6887b3414b90be41c02f9d9..ad008b768a748bafb4ae2f75ae5a49c670c1df8b 100644 (file)
@@ -669,12 +669,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 {