Skip to content

Commit 86b7ebb

Browse files
authored
Merge pull request #115 from DanyaDaro/master
Fix path disclosure
2 parents 2fe1694 + c1d8e82 commit 86b7ebb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

assets/modules/store/update.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<?php
22

3+
error_reporting(0);
34
$url = "http://modx-store.com/get.php?get=file&cid=1";
45
$newfname = 'update.zip';
6+
7+
if(!preg_match('/200/', get_headers($url)[0])){
8+
die('Server not response!');
9+
}
10+
511
if (ini_get('allow_url_fopen') == true) {
612
$file = fopen ($url, "rb");
713
if (! $file) {
@@ -28,13 +34,13 @@
2834
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
2935
}
3036
$content = curl_exec ($ch);
31-
file_put_contents($newfname,$content);
32-
}
33-
37+
file_put_contents($newfname,$content);
38+
}
39+
3440
$zip = new ZipArchive;
3541
$res = $zip->open(dirname(__FILE__).'/update.zip');
3642
$zip->extractTo( dirname(__FILE__) );
3743
$zip->close();
3844
echo dirname(__FILE__).'/update.zip';
3945
unlink('update.zip');
40-
?>
46+
?>

0 commit comments

Comments
 (0)