X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmail%2FUserMailer.php;h=21effa0e02d7a25a09c94a43a300a53944649a68;hb=8c1086225d413bca03e2fce7b8f947e68d0a3a7e;hp=1059d7bce2cc7f2a68a8a0e04fd5eb6c1dbe4d2e;hpb=939199bcea28a3b13c49c0f808d11d415660b924;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/mail/UserMailer.php b/includes/mail/UserMailer.php index 1059d7bce2..21effa0e02 100644 --- a/includes/mail/UserMailer.php +++ b/includes/mail/UserMailer.php @@ -268,7 +268,14 @@ class UserMailer { // Add the envelope sender address using the -f command line option when PHP mail() is used. // Will default to the $from->address when the UserMailerChangeReturnPath hook fails and the // generated VERP address when the hook runs effectively. - $extraParams .= ' -f ' . $returnPath; + + // PHP runs this through escapeshellcmd(). However that's not sufficient + // escaping (e.g. due to spaces). MediaWiki's email sanitizer should generally + // be good enough, but just in case, put in double quotes, and remove any + // double quotes present (" is not allowed in emails, so should have no + // effect, although this might cause apostrophees to be double escaped) + $returnPathCLI = '"' . str_replace( '"', '', $returnPath ) . '"'; + $extraParams .= ' -f ' . $returnPathCLI; $headers['Return-Path'] = $returnPath; @@ -283,7 +290,7 @@ class UserMailer { ->getFullURL( '', false, PROTO_CANONICAL ) . '>'; // Line endings need to be different on Unix and Windows due to - // the bug described at http://trac.wordpress.org/ticket/2603 + // the bug described at https://core.trac.wordpress.org/ticket/2603 $endl = PHP_EOL; if ( is_array( $body ) ) {