Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 1996 16:41:15 +0200 (EET)
From:      Juha Inkari <inkari@snakemail.hut.fi>
To:        freebsd-current@freebsd.org
Subject:   GNU tar 1.11.2
Message-ID:  <199603201441.QAA05944@lk-hp-20.hut.fi>

next in thread | raw e-mail | index | archive | help

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;
      }

----------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603201441.QAA05944>