فهرست منبع

Fix SRC directory being moved on Windows systems: check whether a file was really uploaded;
if not bail out.

Thijs Kinkhorst 23 سال پیش
والد
کامیت
1e317aed3f
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      src/compose.php

+ 5 - 0
src/compose.php

@@ -1109,6 +1109,11 @@ function saveAttachedFiles($session) {
     global $_FILES, $attachment_dir, $attachments, $username,
     global $_FILES, $attachment_dir, $attachments, $username,
            $data_dir, $compose_messages;
            $data_dir, $compose_messages;
 
 
+    /* get out of here if no file was attached at all */
+    if (! is_uploaded_file($_FILES['attachfile']['tmp_name']) ) {
+        return true;
+    }
+
     $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
     $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
     $localfilename = GenerateRandomString(32, '', 7);
     $localfilename = GenerateRandomString(32, '', 7);
     $full_localfilename = "$hashed_attachment_dir/$localfilename";
     $full_localfilename = "$hashed_attachment_dir/$localfilename";