git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
edit: replace executable check by filename validation
[minimedit.git]
/
edit.php
diff --git
a/edit.php
b/edit.php
old mode 100755
(executable)
new mode 100644
(file)
index
1856336
..
cf9b6c0
--- a/
edit.php
+++ b/
edit.php
@@
-14,9
+14,9
@@
if (!isset($_SERVER['PATH_INFO']) or strlen($_SERVER['PATH_INFO']) <= 1)
abort('409 input error', "geen bestand aangeleverd");
$filename = ltrim($Args, '/').'.html';
abort('409 input error', "geen bestand aangeleverd");
$filename = ltrim($Args, '/').'.html';
-if (
file_exists($filename) and !is_writable(
$filename))
+if (
!preg_match('{^(?:[/a-z0-9-])+\.html$}',
$filename))
abort('403 input error', "ongeldige bestandsnaam: $filename");
abort('403 input error', "ongeldige bestandsnaam: $filename");
-if (
is_execu
table($filename))
+if (
file_exists($filename) and !is_wri
table($filename))
abort('403 input error', "onwijzigbaar bestand: $filename");
if (!isset($_POST['body']))
abort('403 input error', "onwijzigbaar bestand: $filename");
if (!isset($_POST['body']))