diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-02 01:21:02 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-02 01:21:02 +0100 |
commit | b80acf58f16339078da5cbee88a322f2450aa2ad (patch) | |
tree | c542be76efce95b7da793c9736fe92d56afb71c1 /archival/tar.c | |
parent | ea6116ee59af0945f4a6ac9ede984930a0ede429 (diff) | |
download | busybox-w32-b80acf58f16339078da5cbee88a322f2450aa2ad.tar.gz busybox-w32-b80acf58f16339078da5cbee88a322f2450aa2ad.tar.bz2 busybox-w32-b80acf58f16339078da5cbee88a322f2450aa2ad.zip |
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.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/archival/tar.c b/archival/tar.c index 1e3cecf44..d43c8dee3 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -397,17 +397,8 @@ static int FAST_FUNC writeFileToTarball(const char *fileName, struct stat *statb | |||
397 | 397 | ||
398 | DBG("writeFileToTarball('%s')", fileName); | 398 | DBG("writeFileToTarball('%s')", fileName); |
399 | 399 | ||
400 | /* Strip leading '/' (must be before memorizing hardlink's name) */ | 400 | /* Strip leading '/' and such (must be before memorizing hardlink's name) */ |
401 | header_name = fileName; | 401 | header_name = strip_unsafe_prefix(fileName); |
402 | while (header_name[0] == '/') { | ||
403 | static smallint warned; | ||
404 | |||
405 | if (!warned) { | ||
406 | bb_error_msg("removing leading '/' from member names"); | ||
407 | warned = 1; | ||
408 | } | ||
409 | header_name++; | ||
410 | } | ||
411 | 402 | ||
412 | if (header_name[0] == '\0') | 403 | if (header_name[0] == '\0') |
413 | return TRUE; | 404 | return TRUE; |