mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Slight improvements to file security (scan for more bad characters)
This commit is contained in:
parent
6e07f68039
commit
780db23080
@ -358,7 +358,13 @@ function get_slash_arguments($i=0) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($PATH_INFO, "..")) { // check for funny business
|
if (strpos($PATH_INFO, "..")) { // check for parent URLs
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (strpos($PATH_INFO, "|")) { // check for pipes
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (strpos($PATH_INFO, "`")) { // check for backquotes
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
user/pix.php
18
user/pix.php
@ -30,14 +30,16 @@
|
|||||||
|
|
||||||
$lastmodified = filemtime($pathname);
|
$lastmodified = filemtime($pathname);
|
||||||
|
|
||||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
|
if (file_exists($pathname)) {
|
||||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
|
||||||
header("Cache-control: max_age = $lifetime"); // a day
|
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
|
||||||
header("Pragma: ");
|
header("Cache-control: max_age = $lifetime"); // a day
|
||||||
header("Content-disposition: inline; filename=$image");
|
header("Pragma: ");
|
||||||
header("Content-length: ".filesize($pathname));
|
header("Content-disposition: inline; filename=$image");
|
||||||
header("Content-type: image/jpeg");
|
header("Content-length: ".filesize($pathname));
|
||||||
readfile("$pathname");
|
header("Content-type: image/jpeg");
|
||||||
|
readfile("$pathname");
|
||||||
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user