summaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorDenys Vlasenko2011-03-02 01:21:02 +0100
committerDenys Vlasenko2011-03-02 01:21:02 +0100
commitb80acf58f16339078da5cbee88a322f2450aa2ad (patch)
treec542be76efce95b7da793c9736fe92d56afb71c1 /archival/tar.c
parentea6116ee59af0945f4a6ac9ede984930a0ede429 (diff)
downloadbusybox-b80acf58f16339078da5cbee88a322f2450aa2ad.zip
busybox-b80acf58f16339078da5cbee88a322f2450aa2ad.tar.gz
tar: skip leading / and handle names like abc/..////def -> def (not ///def)
function old new delta strip_unsafe_prefix - 105 +105 writeFileToTarball 557 520 -37 get_header_tar 1545 1462 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 1e3cecf..d43c8de 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -397,17 +397,8 @@ static int FAST_FUNC writeFileToTarball(const char *fileName, struct stat *statb
DBG("writeFileToTarball('%s')", fileName);
- /* Strip leading '/' (must be before memorizing hardlink's name) */
- header_name = fileName;
- while (header_name[0] == '/') {
- static smallint warned;
-
- if (!warned) {
- bb_error_msg("removing leading '/' from member names");
- warned = 1;
- }
- header_name++;
- }
+ /* Strip leading '/' and such (must be before memorizing hardlink's name) */
+ header_name = strip_unsafe_prefix(fileName);
if (header_name[0] == '\0')
return TRUE;