[commit: Cabal] master: Ignore PAX entries when checking for tarbombs (77095ea)

Ian Lynagh igloo at earth.li
Fri Jun 24 02:04:47 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/77095eaaa2be95b8883b745da46d91ef22f0abd0

>---------------------------------------------------------------

commit 77095eaaa2be95b8883b745da46d91ef22f0abd0
Author: Duncan Coutts <duncan at haskell.org>
Date:   Sun Nov 22 08:02:55 2009 +0000

    Ignore PAX entries when checking for tarbombs
    When checking for tarbombs, ignore PAX entry types 'g' and 'x'.
    These do not get extracted so their names do not matter.

>---------------------------------------------------------------

 cabal-install/Distribution/Client/Tar.hs |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/cabal-install/Distribution/Client/Tar.hs b/cabal-install/Distribution/Client/Tar.hs
index 9b251f0..fd9150a 100644
--- a/cabal-install/Distribution/Client/Tar.hs
+++ b/cabal-install/Distribution/Client/Tar.hs
@@ -446,6 +446,15 @@ checkEntrySecurity entry = case entryContent entry of
       | otherwise = Nothing
 
 checkEntryTarbomb :: FilePath -> Entry -> Maybe String
+checkEntryTarbomb _ entry | nonFilesystemEntry = Nothing
+  where
+    -- Ignore some special entries we will not unpack anyway
+    nonFilesystemEntry =
+      case entryContent entry of
+        OtherEntryType 'g' _ _ -> True --PAX global header
+        OtherEntryType 'x' _ _ -> True --PAX individual header
+        _                      -> False
+
 checkEntryTarbomb expectedTopDir entry =
   case FilePath.Native.splitDirectories (entryPath entry) of
     (topDir:_) | topDir == expectedTopDir -> Nothing





More information about the Cvs-libraries mailing list