svn commit: trunk/busybox/archival/libunarchive

landley at busybox.net landley at busybox.net
Mon Feb 20 19:28:56 UTC 2006


Author: landley
Date: 2006-02-20 11:28:53 -0800 (Mon, 20 Feb 2006)
New Revision: 14150

Log:
Bug 640: a filename of length exactly 100 could bleed into the next field on
display or extract.  (Only shows up when no gnu longname extension, either
because it's disabled or because tarball hasn't got it.)


Modified:
   trunk/busybox/archival/libunarchive/get_header_tar.c


Changeset:
Modified: trunk/busybox/archival/libunarchive/get_header_tar.c
===================================================================
--- trunk/busybox/archival/libunarchive/get_header_tar.c	2006-02-20 19:28:34 UTC (rev 14149)
+++ trunk/busybox/archival/libunarchive/get_header_tar.c	2006-02-20 19:28:53 UTC (rev 14150)
@@ -1,18 +1,5 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+/* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
  *  FIXME:
  *    In privileged mode if uname and gname map to a uid and gid then use the
  *    mapped value instead of the uid/gid values in tar header
@@ -70,7 +57,8 @@
 
 	if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) {
 		/* Assume end of file */
-		return(EXIT_FAILURE);
+		bb_error_msg_and_die("Short header");
+		//return(EXIT_FAILURE);
 	}
 	archive_handle->offset += 512;
 
@@ -120,10 +108,14 @@
 		linkname = NULL;
 	} else
 #endif
-	if (tar.formated.prefix[0] == 0) {
-		file_header->name = strdup(tar.formated.name);
-	} else {
-		file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
+	{
+		file_header->name = strndup(tar.formated.name,100);
+
+		if (tar.formated.prefix[0]) {
+			char *temp = file_header->name;
+			file_header->name = concat_path_file(tar.formated.prefix, temp);
+			free(temp);
+		}
 	}
 
 	file_header->uid = strtol(tar.formated.uid, NULL, 8);




More information about the busybox-cvs mailing list