From 38a659dc102b7a7c29ef5d1dae7a283d8fbbb5bd Mon Sep 17 00:00:00 2001 From: Andrew Davidson Date: Wed, 8 Apr 2015 10:05:08 +0100 Subject: [PATCH] MDL-49787 email: Updated email attachement path check to use realpath() in order to allow for symlinked temp directories --- lib/moodlelib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 33b03249a50..18c9376f686 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -5605,7 +5605,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '', // If the attachment is a full path to a file in the tempdir, use it as is, // otherwise assume it is a relative path from the dataroot (for backwards compatibility reasons). - if (strpos($attachpath, $temppath) !== 0) { + if (strpos($attachpath, realpath($temppath)) !== 0) { $attachmentpath = $CFG->dataroot . '/' . $attachmentpath; }