[Bug-tar] [PATCH] Option to reject files similar to tarbombs

2013-09-21 Thread Connor Behan
A common annoyance in the free software world is an archive that leaves several top-level files in the working directory after being extracted. However, this is a special case of a more general annoyance, where files can also be extracted to paths above the working directory. This adds an option ca

Re: [Bug-tar] [PATCH] Option to reject files similar to tarbombs

2013-09-21 Thread Paul Eggert
A few comments: It shouldn't be necessary to call malloc or to copy the file name except in the special case where the first top level is found. Don't store string lengths in 'int'. Use size_t, in case the string length exceeds INT_MAX. Tar already prevents users from misusing "..", so why does

Re: [Bug-tar] Bug in --remove-files with --append/-r

2013-09-21 Thread Nathan Stratton Treadway
On Sat, Sep 21, 2013 at 01:29:25 -0400, Nathan Stratton Treadway wrote: > So I wonder if the "proper" fix at this point would be to switch > everything to using the "virtual chdir" approach? > > (This seems a little strange, since it means changing the code path for > --create, which is the branch

[Bug-tar] --append combined with --listed-incremental?

2013-09-21 Thread Nathan Stratton Treadway
I notice in --appened mode, the --listed-incremental option is accepted but seems to be completely ignored. Would it make sense to add this combination of options to the list of USAGE_ERRORs at the bottom of tar.c:decode_options() ? Nathan

Re: [Bug-tar] --append combined with --listed-incremental?

2013-09-21 Thread Nathan Stratton Treadway
On Sat, Sep 21, 2013 at 17:09:09 -0400, Nathan Stratton Treadway wrote: > I notice in --appened mode, the --listed-incremental option is accepted > but seems to be completely ignored. > > Would it make sense to add this combination of options to the list of > USAGE_ERRORs at the bottom of tar.c:de

Re: [Bug-tar] [PATCH] Option to reject files similar to tarbombs

2013-09-21 Thread Connor Behan
On 21/09/13 08:28 AM, Paul Eggert wrote: > A few comments: > > It shouldn't be necessary to call malloc or to copy the > file name except in the special case where the first > top level is found. > > Don't store string lengths in 'int'. Use size_t, > in case the string length exceeds INT_MAX. > >

[Bug-tar] [PATCH v2] Option to treat tarbombs as errors

2013-09-21 Thread Connor Behan
This adds the --one-top-level option to reject tarballs that do not follow the practice of having everything in one directory. The only option that appears to be in conflict is --absolute-names because the code assumes that unsafe prefixes like ".." and leading slashes are removed. Archives that fa