Fix for splitting long file names while creating ustar archive

Resolves: #866467
This commit is contained in:
Pavel Raiskup 2012-10-18 15:07:32 +02:00
parent 242ef5e0d3
commit 65fa937be7
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,20 @@
diff --git a/src/tar.c b/src/tar.c
index 97d74bc..6de8961 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -48,10 +48,12 @@ split_long_name (const char *name, size_t length)
{
size_t i;
- if (length > TARPREFIXSIZE)
- length = TARPREFIXSIZE+2;
+ if (length > TARPREFIXSIZE + 1)
+ length = TARPREFIXSIZE + 1;
+ else if (ISSLASH (name[length - 1]))
+ length--;
for (i = length - 1; i > 0; i--)
- if (name[i] == '/')
+ if (ISSLASH (name[i]))
break;
return i;
}

View File

@ -3,7 +3,7 @@
Summary: A GNU archiving program
Name: cpio
Version: 2.11
Release: 11%{?dist}
Release: 12%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/cpio/
@ -22,6 +22,8 @@ Patch4: cpio-2.9.90-defaultremoteshell.patch
Patch5: cpio-2.10-patternnamesigsegv.patch
#fix rawhide buildfailure by updating gnulib's stdio.in.h
Patch6: cpio-2.11-stdio.in.patch
# fix bad file name splitting while creating ustar archive (#866467)
Patch7: cpio-2.10-longnames-split.patch
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
Provides: bundled(gnulib)
@ -50,6 +52,7 @@ Install cpio if you need a program to manage file archives.
%patch4 -p1 -b .defaultremote
%patch5 -p1 -b .patternsegv
%patch6 -p1 -b .gnulib
%patch7 -p1 -b .longnames
autoheader
@ -99,6 +102,9 @@ fi
%{_infodir}/*.info*
%changelog
* Thu Oct 18 2012 Pavel Raiskup <praiskup@redhat.com> 2:10-12
- fix for bad file name splitting while creating ustar archive (#866467)
* Wed Aug 29 2012 Ondrej Vasik <ovasik@redhat.com> 2.11-11
- add missing options to manpage (#852765)