Skip to content

Commit

Permalink
Don't sanitize user email prior to validation
Browse files Browse the repository at this point in the history
Before this, email_is_valid() validated a sanitized string (using
filter_var() with FILTER_SANITIZE_EMAIL).

We now validate the email exactly as it was entered by the user to
ensure we don't accept an address that was actually made valid by the
sanitization itself.

Fixes #17280
  • Loading branch information
dregad committed Apr 18, 2015
1 parent bc195dd commit 7cd2fa5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/email_api.php
Expand Up @@ -136,9 +136,8 @@ function email_is_valid( $p_email ) {

# check email address is a valid format
log_event( LOG_EMAIL, "Validating address '$p_email' with method '$t_method'" );
$t_email = filter_var( $p_email, FILTER_SANITIZE_EMAIL );
if( PHPMailer::ValidateAddress( $t_email, $t_method ) ) {
$t_domain = substr( $t_email, strpos( $t_email, '@' ) + 1 );
if( PHPMailer::ValidateAddress( $p_email, $t_method ) ) {
$t_domain = substr( $p_email, strpos( $p_email, '@' ) + 1 );

# see if we're limited to a set of known domains
$t_limit_email_domains = config_get( 'limit_email_domains' );
Expand Down

0 comments on commit 7cd2fa5

Please sign in to comment.