From owner-freebsd-current Wed Mar 20 06:41:27 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id GAA05634 for current-outgoing; Wed, 20 Mar 1996 06:41:27 -0800 (PST) Received: from snake.hut.fi (root@snake.hut.fi [193.167.6.99]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id GAA05629 for ; Wed, 20 Mar 1996 06:41:22 -0800 (PST) Received: from lk-hp-20.hut.fi (lk-hp-20.hut.fi [130.233.247.33]) by snake.hut.fi (8.7.3/8.7.3) with ESMTP id QAA27563 for ; Wed, 20 Mar 1996 16:41:16 +0200 (EET) From: Juha Inkari Received: (inkari@localhost) by lk-hp-20.hut.fi (8.6.12/8.6.7) id QAA05944 for freebsd-current@freebsd.org; Wed, 20 Mar 1996 16:41:15 +0200 Message-Id: <199603201441.QAA05944@lk-hp-20.hut.fi> Subject: GNU tar 1.11.2 To: freebsd-current@freebsd.org Date: Wed, 20 Mar 1996 16:41:15 +0200 (EET) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I just found, that a command: tar -C /tmp -xsf foo.tar drops core. This is because tar seems to assume, that when s flag is used, there are more arguments to come, and ends up calling strlen(0) (see patch below). I looked up GNU tar 1.11.8 (dated May 1995), and the code indeed seems to have changed a bit. It doesn't work correctly either, but gives a "Missing file name after -C". However, is anyone considered bumping the tar version from 1.11.2 (March 1993) to 1.11.8 for any reason whatever ? ---------------------------------------------- *** tar.orig/tar.c Thu Oct 26 12:59:43 1995 --- tar/tar.c Wed Mar 20 15:51:04 1996 *************** *** 1010,1027 **** } namebuf->change_dir = chdir_name; } ! namebuf->length = strlen (p); ! if (namebuf->length >= namelen) ! { ! namebuf = (struct name *) ck_realloc (namebuf, sizeof (struct name) + namebuf->length); ! namelen = namebuf->length; ! } ! strncpy (namebuf->name, p, namebuf->length); ! namebuf->name[namebuf->length] = 0; ! namebuf->next = (struct name *) NULL; ! namebuf->found = 0; ! namelist = namebuf; ! namelast = namelist; } return; } --- 1010,1030 ---- } namebuf->change_dir = chdir_name; } ! if (p) ! { ! namebuf->length = strlen (p); ! if (namebuf->length >= namelen) ! { ! namebuf = (struct name *) ck_realloc (namebuf, sizeof (struct name) + namebuf->length); ! namelen = namebuf->length; ! } ! strncpy (namebuf->name, p, namebuf->length); ! namebuf->name[namebuf->length] = 0; ! namebuf->next = (struct name *) NULL; ! namebuf->found = 0; ! namelist = namebuf; ! namelast = namelist; ! } } return; } ----------------------------------------------