aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-02-20 19:28:53 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-02-20 19:28:53 +0000
commit316cce65e774877da1c975bace65d235958848ec (patch)
tree6d0e9b40b1b709284615b869f32926ee322ec269 /archival
parent15892dedae4e2e0b0f2539859d79fcec6e955a7f (diff)
downloadbusybox-w32-316cce65e774877da1c975bace65d235958848ec.tar.gz
busybox-w32-316cce65e774877da1c975bace65d235958848ec.tar.bz2
busybox-w32-316cce65e774877da1c975bace65d235958848ec.zip
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.) git-svn-id: svn://busybox.net/trunk/busybox@14150 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/get_header_tar.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 26dfad55f..19793b718 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -1,17 +1,4 @@
1/* 1/* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 * 2 *
16 * FIXME: 3 * FIXME:
17 * In privileged mode if uname and gname map to a uid and gid then use the 4 * 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)
70 57
71 if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) { 58 if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) {
72 /* Assume end of file */ 59 /* Assume end of file */
73 return(EXIT_FAILURE); 60 bb_error_msg_and_die("Short header");
61 //return(EXIT_FAILURE);
74 } 62 }
75 archive_handle->offset += 512; 63 archive_handle->offset += 512;
76 64
@@ -120,10 +108,14 @@ extern char get_header_tar(archive_handle_t *archive_handle)
120 linkname = NULL; 108 linkname = NULL;
121 } else 109 } else
122#endif 110#endif
123 if (tar.formated.prefix[0] == 0) { 111 {
124 file_header->name = strdup(tar.formated.name); 112 file_header->name = strndup(tar.formated.name,100);
125 } else { 113
126 file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name); 114 if (tar.formated.prefix[0]) {
115 char *temp = file_header->name;
116 file_header->name = concat_path_file(tar.formated.prefix, temp);
117 free(temp);
118 }
127 } 119 }
128 120
129 file_header->uid = strtol(tar.formated.uid, NULL, 8); 121 file_header->uid = strtol(tar.formated.uid, NULL, 8);