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.)
This commit is contained in:
Rob Landley 2006-02-20 19:28:53 +00:00
parent dcbad607fc
commit 06249fee39

View File

@ -1,17 +1,4 @@
/*
* 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.
*
* 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.
/* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* FIXME:
* In privileged mode if uname and gname map to a uid and gid then use the
@ -70,7 +57,8 @@ extern char get_header_tar(archive_handle_t *archive_handle)
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 @@ extern char get_header_tar(archive_handle_t *archive_handle)
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);