Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ff257e

Browse files
authored
Merge pull request Codiad#974 from luminoslty/master
Fixed vulnerability.
2 parents a30ff31 + 517119d commit 8ff257e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

common.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ public static function getJSON($file,$namespace=""){
180180
}
181181

182182
$json = file_get_contents($path . $file);
183+
$json = str_replace(["\n\r", "\r", "\n"], "", $json);
183184
$json = str_replace("|*/?>","",str_replace("<?php/*|","",$json));
184185
$json = json_decode($json,true);
185186
return $json;
@@ -197,7 +198,7 @@ public static function saveJSON($file,$data,$namespace=""){
197198
if(!is_dir($path)) mkdir($path);
198199
}
199200

200-
$data = "<?php/*|" . json_encode($data) . "|*/?>";
201+
$data = "<?php\r\n/*|" . json_encode($data) . "|*/\r\n?>";
201202
$write = fopen($path . $file, 'w') or die("can't open file ".$path.$file);
202203
fwrite($write, $data);
203204
fclose($write);

components/install/process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function saveFile($file, $data)
3333

3434
function saveJSON($file, $data)
3535
{
36-
$data = "<?php/*|" . json_encode($data) . "|*/?>";
36+
$data = "<?php/*|\r\n" . json_encode($data) . "\r\n|*/?>";
3737
saveFile($file, $data);
3838
}
3939

0 commit comments

Comments
 (0)