Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-4923

compress_tar incorrectly determines type

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.0.RC1
    • 3.0.8-RC1
    • Other
    • None
    • PHP Environment:
      Database:

    Description

      The class compress_tar in file includes/functions_compress.php tries to determine the exact type of the tarball like this:
      $this->isgz = (strpos($type, '.tar.gz') !== false || strpos($type, '.tgz') !== false) ? true : false;
      $this->isbz = (strpos($type, '.tar.bz2') !== false) ? true : false;

      Obviously, this can lead to problems on malformed filenames like foo.tgz.tar.bz2. The type would be determined as a gzip-compressed tarball, instead of a bzip-compressed one. It would be safer to match the type using a regular expression, including the end-of-string delimiter:
      $this->isgz = (preg_match('#.tar.gz$#i', $type) ? .....

      This doesn't affect Olympus itself, but could cause a problem if the class is used more widely.

      Attachments

        Activity

          People

            naderman Nils Adermann
            hades79 hades79
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: