BUGFIX Fixed possible SQL injection in file name part for File::find()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73436 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-03-20 01:36:19 +00:00
parent 19406d904c
commit 69f1595cc8

View File

@ -70,7 +70,8 @@ class File extends DataObject {
foreach($parts as $part) { foreach($parts as $part) {
if($part == "assets" && !$parentID) continue; if($part == "assets" && !$parentID) continue;
$item = DataObject::get_one("File", "\"Name\" = '$part' AND \"ParentID\" = $parentID"); $SQL_part = Convert::raw2sql($part);
$item = DataObject::get_one("File", "\"Name\" = '$SQL_part' AND \"ParentID\" = $parentID");
if(!$item) break; if(!$item) break;
$parentID = $item->ID; $parentID = $item->ID;
} }