MDL-49787 email: Updated email attachement path check to use realpath() in order to allow for symlinked temp directories

This commit is contained in:
Andrew Davidson
2015-05-18 12:04:50 +01:00
parent 18202cbed7
commit 4ee8f04bef
+1 -1
View File
@@ -5946,7 +5946,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;
}