MDL-58121 email: ensure support user is defined in email_to_user

This commit is contained in:
Jake Dallimore 2017-03-02 10:34:45 +08:00
parent 98c4094eac
commit 62b482938b
2 changed files with 14 additions and 0 deletions

View file

@ -5961,6 +5961,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
if ($attachment && $attachname) {
if (preg_match( "~\\.\\.~" , $attachment )) {
// Security check for ".." in dir path.
$supportuser = core_user::get_support_user();
$temprecipients[] = array($supportuser->email, fullname($supportuser, true));
$mail->addStringAttachment('Error in attachment. User attempted to attach a filename with a unsafe name.', 'error.txt', '8bit', 'text/plain');
} else {