From ec491764daa74ff34206097690ceb21eb23c0527 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Sun, 18 Feb 2001 01:06:13 +0000 Subject: 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. --- gnu/usr.bin/tar/diffarch.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gnu') diff --git a/gnu/usr.bin/tar/diffarch.c b/gnu/usr.bin/tar/diffarch.c index 80e48bccaad2..b1ca5912a53a 100644 --- a/gnu/usr.bin/tar/diffarch.c +++ b/gnu/usr.bin/tar/diffarch.c @@ -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 -- cgit v1.3