diff options
author | Valérian Saliou <valerian@valeriansaliou.name> | 2015-08-07 14:27:54 +0300 |
---|---|---|
committer | Valérian Saliou <valerian@valeriansaliou.name> | 2015-08-07 14:27:54 +0300 |
commit | 319eaf3f7e9224dfc5d172542c1f621aab94be46 (patch) | |
tree | dd8c1416f57a2e76887ead0e1a55db4d305a540f | |
parent | 4079e0f28feb3bd6d057b487151694981258278e (diff) |
Disallow control characters
Signed-off-by: Valérian Saliou <valerian@valeriansaliou.name>
-rw-r--r-- | server/functions.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/functions.php b/server/functions.php index e38196f9..7706beca 100644 --- a/server/functions.php +++ b/server/functions.php @@ -1141,7 +1141,9 @@ function securityHTML() { // Checks if a relative server path is safe function isSafe($path) { - return !preg_match('/^\//', $path) && !preg_match('/\.\.\//', $path); + return !preg_match('/^\//', $path) && # Absolute path (forbidden) + !preg_match('/\.\.\//', $path) && # Previous directory (forbidden) + !preg_match('/[[:cntrl:]]/', $path); # Control characters (forbidden) } // Checks if a relative server path is safe |