Quick fix for attempts to free non-malloc()ed memory. The variables

current_file_name and current_link_name sometimes point into the
middle of malloc()ed memory and sometimes point to alloca()ed memory,
but free() is sometimes called on them.  This seems to be harmless
for the usual tar operations, but it is usually fatal for `tar -W'.
E.g., for `cd /etc; tar Wcf /tmp/foo rc', at the start of
verify_volume(), current_file_name points to alloca()ed memory, and
tar attempts to free it.
This commit is contained in:
Bruce Evans 2001-02-18 01:06:13 +00:00
parent 960cada9b8
commit ec491764da
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=72584

View file

@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
along with GNU Tar; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $FreeBSD$ */
/*
* Diff files from a tar archive.
*
@ -493,6 +495,8 @@ verify_volume ()
int er;
#endif
current_file_name = NULL;
current_link_name = NULL;
if (!diff_buf)
diff_init ();
#ifdef MTIOCTOP