浏览代码

Minor bug that let the user get files from any directory on the server using
../../dir/dir as attachments fixed.

gustavf 25 年之前
父节点
当前提交
a92d01f2e1
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      functions/smtp.php

+ 4 - 0
functions/smtp.php

@@ -24,6 +24,10 @@
       global $attachments, $attachment_dir;
 
       while (list($localname, $remotename) = each($attachments)) {
+         // This is to make sure noone is giving a filename in another
+         // directory
+         $localname = ereg_replace ("\\/", "", $localname);
+
          $fileinfo = fopen ($attachment_dir.$localname.".info", "r");
          $filetype = fgets ($fileinfo, 8192);
          fclose ($fileinfo);