]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Better validation of input in php-admin (Thomas Goirand)
authorBen Schmidt <none@none>
Sun, 18 Jul 2010 11:46:30 +0000 (21:46 +1000)
committerBen Schmidt <none@none>
Sun, 18 Jul 2010 11:46:30 +0000 (21:46 +1000)
ChangeLog
contrib/web/php-admin/htdocs/edit.php
contrib/web/php-admin/htdocs/save.php

index 46f30fdc1823a4386366c77798cc618e1381d4a6..90a41aae535d20dfc9ae4d0f77b507a4ceca7533 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+ o Better validation of input in php-admin (Thomas Goirand)
  o Added Turkish translation (Samed Beyribey)
  o Fixed security bug in mlmmj-php-admin (Florian Streibelt, Morten Shearman
    Kirkegaard)
index d61d09911eaf49dc2ca66a29707c9d0fa412feed..2d8b58269e3c9ef06cf9b8332ccdb9eb0dd6062e 100644 (file)
@@ -104,14 +104,8 @@ $list = $HTTP_GET_VARS["list"];
 if(!isset($list))
 die("no list specified");
 
-if (strchr($list, "/") !== false)
-die("slash in list name");
-
-if ($list == ".")
-die("list name is dot");
-
-if ($list == "..")
-die("list name is dot-dot");
+if (dirname(realpath($topdir."/".$list)) != $topdir)
+die("list outside topdir");
 
 if(!is_dir($topdir."/".$list))
 die("non-existent list");
index c59a21320266c75c4e7507f95277ac36db85c329..908b8144d8c0ebbf12cc1c23b284ee00f3045b8b 100644 (file)
@@ -79,14 +79,8 @@ $list = $HTTP_POST_VARS["list"];
 if(!isset($list))
 die("no list specified");
 
-if (strchr($list, "/") !== false)
-die("slash in list name");
-
-if ($list == ".")
-die("list name is dot");
-
-if ($list == "..")
-die("list name is dot-dot");
+if (dirname(realpath($topdir."/".$list)) != $topdir)
+die("list outside topdir");
 
 if(!is_dir($topdir."/".$list))
 die("non-existent list");