File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -704,12 +704,22 @@ sub generate_random_password {
704704sub validate_email_syntax {
705705 my ($addr ) = @_ ;
706706 my $match = Bugzilla-> params-> {' emailregexp' };
707- my $ret = ($addr =~ / $match / && $addr !~ / [\\\(\) <>&,;:"\[\] \t\r\n\P{ASCII} ]/ );
708- if ($ret ) {
707+ my $email = $addr . Bugzilla-> params-> {' emailsuffix' };
708+ # This regexp follows RFC 2822 section 3.4.1.
709+ my $addr_spec = $Email::Address::addr_spec ;
710+ # RFC 2822 section 2.1 specifies that email addresses must
711+ # be made of US-ASCII characters only.
712+ # Email::Address::addr_spec doesn't enforce this.
713+ if ($addr =~ / $match /
714+ && $email !~ / \P{ASCII} /
715+ && $email =~ / ^$addr_spec $ /
716+ && length ($email ) <= 127)
717+ {
709718 # We assume these checks to suffice to consider the address untainted.
710719 trick_taint($_ [0]);
720+ return 1;
711721 }
712- return $ret ? 1 : 0;
722+ return 0;
713723}
714724
715725sub validate_date {
You can’t perform that action at this time.
0 commit comments