diff options
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 30 |
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); |