tar and /

Ian Lepore ian at FreeBSD.org
Tue Oct 7 13:53:55 UTC 2014


On Tue, 2014-10-07 at 09:44 +0300, Daniel Braniss wrote:
> hi,
> for security reasons tar removes the leading /, which is fine.
> so I can chadir to /var/tmp, and do an extract there. The problem arises when there
> is a file that is linked to /…
> Is there some way to drop that leading ‘/‘ too?
> 
> cheers,
> 

No, because the leading slash there is the data within the link file,
not metadata describing the file which tar stores separately and can
easily manipulate.  The moral is to avoid rooted links, even though that
can lead to things nearly as bad, such as links that begin with 8 levels
of ../

-- Ian




More information about the freebsd-hackers mailing list