summaryrefslogtreecommitdiff
path: root/itjs.class
diff options
context:
space:
mode:
authorUrban Müller2015-11-18 15:39:20 +0100
committerUrban Müller2015-11-18 15:41:13 +0100
commitb52db895457e3b2470409a892e0de944e23ea4be (patch)
treeee664e4c82481132acf56bf1f2f6627c0061f075 /itjs.class
parent791239bfb548b7524c309e7c6c522165875ae4ea (diff)
downloaditools-b52db895457e3b2470409a892e0de944e23ea4be.tar.gz
itools-b52db895457e3b2470409a892e0de944e23ea4be.tar.bz2
itools-b52db895457e3b2470409a892e0de944e23ea4be.zip
security: whitelist legal chars
Diffstat (limited to 'itjs.class')
-rw-r--r--itjs.class7
1 files changed, 5 insertions, 2 deletions
diff --git a/itjs.class b/itjs.class
index c54abd3..8e79fad 100644
--- a/itjs.class
+++ b/itjs.class
@@ -134,9 +134,12 @@ static function filenames($filelist)
"PIE.htc" => "$libsearch/doc/PIE.htc",
);
- foreach (array_filter(explode(",", basename($filelist))) as $file)
+ if (it::match("[^-\w.=?&,]", basename($filelist)))
+ it::error("bad filelist $filelist");
+
+ foreach (it::match("[-\w.=?&]+", basename($filelist), array('all' => true)) as $file)
{
- $filenames = $special[$file] ?: (file_exists("$path/" . it::replace(array('[\?\x00].*' => ""), $file)) ? "$path/$file" : "$libsearch/itjs/$file");
+ $filenames = $special[$file] ?: (file_exists("$path/$file") ? "$path/$file" : "$libsearch/itjs/$file");
foreach (explode(",", $filenames) as $filename)
if (!$seen[$filename]++)