View Issue Details

IDProjectCategoryView StatusLast Update
0001154OXID eShop (all versions)2. ----- eShop backend (admin) -----public2009-08-05 16:59
Reportermarco_steinhaeuser Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.1.3 revision 19918 
Fixed in Version4.1.5 revision 21618 
Summary0001154: upload using oxUtilsFile()
DescriptionUploading a file using class oxUtilsFile line 551, an existing filename will be extended by adding a (1) to the file name. Doing that a lot of times, the file name becomes something like "name(1)(1)(1)(1)(1).dat" <-- this is how you can crash the best file system.
Additional Informationhttp://www.oxid-esales.com/forum/showthread.php?t=1912

Solution (thanks inveris!)
==========================
in core/oxutilsfile.php, line 551, replace

        //file exists ?
        while (file_exists($sBasePath . "/" .$sUploadPath . "/" . $sFileName . "." . $sExt)) {
            $sFileName .= "(1)";
        }

by

        //file exists ?
        $fileCounter = 0;
        $tempFileName = $sFileName;
        while (file_exists($sBasePath . "/" .$sUploadPath . "/" . $sFileName . "." . $sExt)) {
            $fileCounter++;
            $sFileName = $tempFileName . "($fileCounter)";
        }
TagsNo tags attached.
Theme
BrowserAll
PHP Version5.2.6
Database Version5.0.33

Activities

rimvydas_paskevicius

2009-08-05 16:59

reporter   ~0001363

Updated code to fix occured problem