aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-11 22:20:59 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-11 22:20:59 +0000
commitee1b3b1042c8077cda5027bc0ce317662a1d8feb (patch)
treec62350385e56ce7c31479b6e0e99357bd2dbaf29
parente18d21dda419e768ca047aa74af869e8b5d901c2 (diff)
downloadbusybox-w32-ee1b3b1042c8077cda5027bc0ce317662a1d8feb.tar.gz
busybox-w32-ee1b3b1042c8077cda5027bc0ce317662a1d8feb.tar.bz2
busybox-w32-ee1b3b1042c8077cda5027bc0ce317662a1d8feb.zip
cpio: on unpack, limit filename length to 8k; shorten comment a bit
-rw-r--r--archival/cpio.c28
-rw-r--r--archival/libunarchive/get_header_cpio.c2
2 files changed, 15 insertions, 15 deletions
diff --git a/archival/cpio.c b/archival/cpio.c
index 530af802a..9784121b1 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -178,19 +178,19 @@ static int cpio_o(void)
178} 178}
179#endif 179#endif
180 180
181/* GNU cpio (GNU cpio) 2.9 help (abridged): 181/* GNU cpio 2.9 --help (abridged):
182 182
183 Main operation mode: 183 Modes:
184 -i, --extract Extract files from an archive 184 -i, --extract Extract files from an archive
185 -o, --create Create the archive 185 -o, --create Create the archive
186 -p, --pass-through Copy-pass mode (was ist das?!) 186 -p, --pass-through Copy-pass mode [was ist das?!]
187 -t, --list List the archive 187 -t, --list List the archive
188 188
189 Operation modifiers valid in any mode: 189 Options valid in any mode:
190 --block-size=SIZE I/O block size = SIZE * 512 bytes 190 --block-size=SIZE I/O block size = SIZE * 512 bytes
191 -B I/O block size = 5120 bytes 191 -B I/O block size = 5120 bytes
192 -c Use the old portable (ASCII) archive format 192 -c Use the old portable (ASCII) archive format
193 -C, --io-size=NUMBER I/O block size to the given NUMBER bytes 193 -C, --io-size=NUMBER I/O block size in bytes
194 -f, --nonmatching Only copy files that do not match given pattern 194 -f, --nonmatching Only copy files that do not match given pattern
195 -F, --file=FILE Use FILE instead of standard input or output 195 -F, --file=FILE Use FILE instead of standard input or output
196 -H, --format=FORMAT Use given archive FORMAT 196 -H, --format=FORMAT Use given archive FORMAT
@@ -204,7 +204,7 @@ static int cpio_o(void)
204 -W, --warning=FLAG Control warning display: 'none','truncate','all'; 204 -W, --warning=FLAG Control warning display: 'none','truncate','all';
205 multiple options accumulate 205 multiple options accumulate
206 206
207 Operation modifiers valid only in --extract mode: 207 Options valid only in --extract mode:
208 -b, --swap Swap both halfwords of words and bytes of 208 -b, --swap Swap both halfwords of words and bytes of
209 halfwords in the data (equivalent to -sS) 209 halfwords in the data (equivalent to -sS)
210 -r, --rename Interactively rename files 210 -r, --rename Interactively rename files
@@ -215,31 +215,29 @@ static int cpio_o(void)
215 extract or list from FILE 215 extract or list from FILE
216 --only-verify-crc Verify CRC's, don't actually extract the files 216 --only-verify-crc Verify CRC's, don't actually extract the files
217 217
218 Operation modifiers valid only in --create mode: 218 Options valid only in --create mode:
219 -A, --append Append to an existing archive 219 -A, --append Append to an existing archive
220 -O FILE File to use instead of standard output 220 -O FILE File to use instead of standard output
221 221
222 Operation modifiers valid only in --pass-through mode: 222 Options valid only in --pass-through mode:
223 -l, --link Link files instead of copying them, when possible 223 -l, --link Link files instead of copying them, when possible
224 224
225 Operation modifiers valid in --extract and --create modes: 225 Options valid in --extract and --create modes:
226 --absolute-filenames Do not strip file system prefix components from 226 --absolute-filenames Do not strip file system prefix components from
227 the file names 227 the file names
228 --no-absolute-filenames Create all files relative to the current dir 228 --no-absolute-filenames Create all files relative to the current dir
229 229
230 Operation modifiers valid in --create and --pass-through modes: 230 Options valid in --create and --pass-through modes:
231 -0, --null A list of filenames is terminated by a NUL 231 -0, --null A list of filenames is terminated by a NUL
232 -a, --reset-access-time Reset the access times of files after reading them 232 -a, --reset-access-time Reset the access times of files after reading them
233 -I FILE File to use instead of standard input 233 -I FILE File to use instead of standard input
234 -L, --dereference Dereference symbolic links (copy the files 234 -L, --dereference Dereference symbolic links (copy the files
235 that they point to instead of copying the links) 235 that they point to instead of copying the links)
236 -R, --owner=[USER][:.][GROUP] Set owner of created files 236 -R, --owner=[USER][:.][GROUP] Set owner of created files
237 237
238 Operation modifiers valid in --extract and --pass-through modes: 238 Options valid in --extract and --pass-through modes:
239 -d, --make-directories Create leading directories where needed 239 -d, --make-directories Create leading directories where needed
240 -m, --preserve-modification-time 240 -m, --preserve-modification-time Retain mtime when creating files
241 Retain previous file modification times when
242 creating files
243 --no-preserve-owner Do not change the ownership of the files 241 --no-preserve-owner Do not change the ownership of the files
244 --sparse Write files with blocks of zeros as sparse files 242 --sparse Write files with blocks of zeros as sparse files
245 -u, --unconditional Replace all files unconditionally 243 -u, --unconditional Replace all files unconditionally
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c
index 95d36cca8..307d2a66d 100644
--- a/archival/libunarchive/get_header_cpio.c
+++ b/archival/libunarchive/get_header_cpio.c
@@ -37,6 +37,7 @@ char FAST_FUNC get_header_cpio(archive_handle_t *archive_handle)
37 /* There can be padding before archive header */ 37 /* There can be padding before archive header */
38 data_align(archive_handle, 4); 38 data_align(archive_handle, 4);
39 39
40//TODO: this function is used only here, make it static?
40 if (archive_xread_all_eof(archive_handle, (unsigned char*)cpio_header, 110) == 0) { 41 if (archive_xread_all_eof(archive_handle, (unsigned char*)cpio_header, 110) == 0) {
41 goto create_hardlinks; 42 goto create_hardlinks;
42 } 43 }
@@ -61,6 +62,7 @@ char FAST_FUNC get_header_cpio(archive_handle_t *archive_handle)
61 file_header->mtime = mtime; 62 file_header->mtime = mtime;
62 file_header->size = size; 63 file_header->size = size;
63 64
65 namesize &= 0x1fff; /* paranoia: names can't be that long */
64 file_header->name = xzalloc(namesize + 1); 66 file_header->name = xzalloc(namesize + 1);
65 /* Read in filename */ 67 /* Read in filename */
66 xread(archive_handle->src_fd, file_header->name, namesize); 68 xread(archive_handle->src_fd, file_header->name, namesize);