Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-4923

compress_tar incorrectly determines type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0.8-RC1
    • 3.0.RC1
    • Other
    • None
    • PHP Environment:
      Database:

      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.

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

              Created:
              Updated:
              Resolved: