svn commit: trunk/busybox/archival: libunarchive

vda at busybox.net vda at busybox.net
Fri Jul 11 22:20:59 UTC 2008


Author: vda
Date: 2008-07-11 15:20:59 -0700 (Fri, 11 Jul 2008)
New Revision: 22804

Log:
cpio: on unpack, limit filename length to 8k; shorten comment a bit



Modified:
   trunk/busybox/archival/cpio.c
   trunk/busybox/archival/libunarchive/get_header_cpio.c


Changeset:
Modified: trunk/busybox/archival/cpio.c
===================================================================
--- trunk/busybox/archival/cpio.c	2008-07-11 22:19:21 UTC (rev 22803)
+++ trunk/busybox/archival/cpio.c	2008-07-11 22:20:59 UTC (rev 22804)
@@ -178,19 +178,19 @@
 }
 #endif
 
-/* GNU cpio (GNU cpio) 2.9 help (abridged):
+/* GNU cpio 2.9 --help (abridged):
 
- Main operation mode:
+ Modes:
   -i, --extract              Extract files from an archive
   -o, --create               Create the archive
-  -p, --pass-through         Copy-pass mode (was ist das?!)
+  -p, --pass-through         Copy-pass mode [was ist das?!]
   -t, --list                 List the archive
 
- Operation modifiers valid in any mode:
+ Options valid in any mode:
       --block-size=SIZE      I/O block size = SIZE * 512 bytes
   -B                         I/O block size = 5120 bytes
   -c                         Use the old portable (ASCII) archive format
-  -C, --io-size=NUMBER       I/O block size to the given NUMBER bytes
+  -C, --io-size=NUMBER       I/O block size in bytes
   -f, --nonmatching          Only copy files that do not match given pattern
   -F, --file=FILE            Use FILE instead of standard input or output
   -H, --format=FORMAT        Use given archive FORMAT
@@ -204,7 +204,7 @@
   -W, --warning=FLAG         Control warning display: 'none','truncate','all';
                              multiple options accumulate
 
- Operation modifiers valid only in --extract mode:
+ Options valid only in --extract mode:
   -b, --swap                 Swap both halfwords of words and bytes of
                              halfwords in the data (equivalent to -sS)
   -r, --rename               Interactively rename files
@@ -215,31 +215,29 @@
                              extract or list from FILE
       --only-verify-crc      Verify CRC's, don't actually extract the files
 
- Operation modifiers valid only in --create mode:
+ Options valid only in --create mode:
   -A, --append               Append to an existing archive
   -O FILE                    File to use instead of standard output
 
- Operation modifiers valid only in --pass-through mode:
+ Options valid only in --pass-through mode:
   -l, --link                 Link files instead of copying them, when possible
 
- Operation modifiers valid in --extract and --create modes:
+ Options valid in --extract and --create modes:
       --absolute-filenames   Do not strip file system prefix components from
                              the file names
       --no-absolute-filenames Create all files relative to the current dir
 
- Operation modifiers valid in --create and --pass-through modes:
+ Options valid in --create and --pass-through modes:
   -0, --null                 A list of filenames is terminated by a NUL
   -a, --reset-access-time    Reset the access times of files after reading them
   -I FILE                    File to use instead of standard input
-  -L, --dereference          Dereference symbolic links (copy  the files
+  -L, --dereference          Dereference symbolic links (copy the files
                              that they point to instead of copying the links)
   -R, --owner=[USER][:.][GROUP] Set owner of created files
 
- Operation modifiers valid in --extract and --pass-through modes:
+ Options valid in --extract and --pass-through modes:
   -d, --make-directories     Create leading directories where needed
-  -m, --preserve-modification-time
-                             Retain previous file modification times when
-                             creating files
+  -m, --preserve-modification-time  Retain mtime when creating files
       --no-preserve-owner    Do not change the ownership of the files
       --sparse               Write files with blocks of zeros as sparse files
   -u, --unconditional        Replace all files unconditionally

Modified: trunk/busybox/archival/libunarchive/get_header_cpio.c
===================================================================
--- trunk/busybox/archival/libunarchive/get_header_cpio.c	2008-07-11 22:19:21 UTC (rev 22803)
+++ trunk/busybox/archival/libunarchive/get_header_cpio.c	2008-07-11 22:20:59 UTC (rev 22804)
@@ -37,6 +37,7 @@
 	/* There can be padding before archive header */
 	data_align(archive_handle, 4);
 
+//TODO: this function is used only here, make it static?
 	if (archive_xread_all_eof(archive_handle, (unsigned char*)cpio_header, 110) == 0) {
 		goto create_hardlinks;
 	}
@@ -61,6 +62,7 @@
 	file_header->mtime = mtime;
 	file_header->size = size;
 
+	namesize &= 0x1fff; /* paranoia: names can't be that long */
 	file_header->name = xzalloc(namesize + 1);
 	/* Read in filename */
 	xread(archive_handle->src_fd, file_header->name, namesize);




More information about the busybox-cvs mailing list