path: root/src
AgeCommit message (Collapse)AuthorFiles
2021-01-08Update gnulibHEADmasterSergey Poznyakoff1
* NEWS: Raise version number. * Raise version number to 2.13.90. Raise autoconf and automake requirements. * gnulib: Pull v0.1-4336-gbdae9a5 * gnulib.modules: Remove getopt * src/copyin.c (long_format): Cast rdev numbers to unsigned long
2021-01-06Update copyright yearsSergey Poznyakoff24
2020-02-08Update copyright yearsSergey Poznyakoff24
2020-01-20Minor fixSergey Poznyakoff1
* src/global.c: Remove superfluous declaration of program_name
2019-11-16Fix handling of device numbers (part 2)Sergey Poznyakoff1
Previously the members of cpio_file_stat that hold device major and minor numbers were signed (long). This caused issues when the device number was cast to unsigned value (uintmax_t) during a call to to_ascii or derived function. In particular, on *BSD systems minor numbers are negative ints. When such numbers are passed to to_ascii, the resulting unsigned representation does not fit into the target field width. For details, see To fix this, the return types are autodetected by configure. The types of the c_dev_maj, c_dev_min, c_rdev_maj, and c_rdev_min members of struct cpio_file_stat are changed to unsigned versions of the corresponding detected types. This ensures that the value returned from major (or minor) will not undergo sign extension during assignment to the struct member and can be correctly promoted to a wider unsigned data type. * am/ax_compile_check_rettype.m4: New macro AC_COMPILE_CHECK_RETTYPE * Detect return types of major(3) and minor(3). * src/cpiohdr.h (cpio_file_stat): Change types of c_dev_maj, c_dev_min, c_rdev_maj, c_rdev_min.
2019-11-14Fix handling of device numbers on copy out.Sergey Poznyakoff1
Device minor and major numbers are meaningful only for devices. Don't attempt to store them for other files. Instead fill the corresponding fields with zeros. * src/util.c (stat_to_cpio): Initialize c_rdev_maj and c_rdev_min from struct stat only if the file is a device, otherwise set them to zero.
2019-11-08Improve 684b7ac5Sergey Poznyakoff1
* src/copyin.c (read_name_from_file): Handle len == 0.
2019-11-08Fix cpio header verification.Sergey Poznyakoff1
* src/copyin.c (read_name_from_file): Print error message and skip file if its name is not nul-terminated.
2019-11-06Version 2.13release_2_13Sergey Poznyakoff1
* NEWS: Describe new version. * version 2.13 * src/copyin.c: Fix strict aliasing violation. * tests/ New file. * tests/ Add new test. * tests/ Add new test,
2019-11-04Various fixesSergey Poznyakoff3
* doc/cpio.texi: Document URLs of the mailing list archive and subscription interface. * src/copyin.c (try_existing_file): Change type of the last argument. (copyin_file): Initialize existing_dir. * src/dstring.c: Include xalloc.h * src/filemode.c (mode_string): mode is unsigned int.
2019-11-04Get rid of the unnecessary workaround.Sergey Poznyakoff1
2019-11-04Don't repeat the help reference message.Sergey Poznyakoff1
* src/main.c (process_args): Don't specify the "Try cpio --help" message explicitly. It is added automatically by the USAGE_ERROR macro.
2019-11-03Fix CVE-2019-14866Sergey Poznyakoff3
* src/copyout.c (to_ascii): Additional argument nul controls whether to add the terminating nul character. (field_width_error): Improve diagnostics: print the actual and the maximum allowed field value. * src/extern.h (to_ascii, field_width_error): New prototypes. * src/tar.c (to_oct): Remove. (to_oct_or_error): New function. (TO_OCT): New macro. (write_out_tar_header): Use TO_OCT and to_ascii. Return 0 on success, 1 on error.
2019-11-03Fix CVE-2015-1197Sergey Poznyakoff1
* src/copyin.c (copyin_link): Force safer name suffix for symbolic links. * tests/ New file. * tests/ Add new test case. * tests/ Likewise.
2019-11-03Provide functions for struct cpio_file_stat management.Sergey Poznyakoff7
* src/copyin.c (long_format): Mark unchangeable argument as const. (read_name_from_file): Use cpio_realloc_c_name. (process_copy_in): Use CPIO_FILE_STAT_INITIALIZER. Call cpio_file_stat_free before return. * src/copyout.c (process_copy_out): Likewise. * src/copypass.c (link_to_name): Mark unchangeable argument as const. * src/cpiohdr.h (cpio_file_stat) <c_name_buflen>: New member, <c_tar_linkname>: Mark as const. (CPIO_FILE_STAT_INITIALIZER): New define. (cpio_file_stat_init,cpio_file_stat_free) (cpio_realloc_c_name): New protos. * src/extern.h: Fix prototypes. * src/makepath.c (make_path): Mark unchangeable argument as const. * src/util.c (create_all_directories): Mark unchangeable argument as const. (cpio_realloc_c_name): New function. (cpio_set_c_name): Use cpio_realloc_c_name. (cpio_file_stat_init,cpio_file_stat_free): New functions.
2019-11-03Remove HPUX CDF supportSergey Poznyakoff4
2018-12-01Minor fixesSergey Poznyakoff2
* src/copyin.c: Remove unused variable. * src/util.c: Cast arguments to printf.
2018-12-01Fix sigfault when appending to archiveSergey Poznyakoff1
Bug reported by Ross Burton. See <> * src/util.c: Keep static copy of the buffer pointer; always assign it to file_hdr->c_name. Use x2realloc for memory management.
2017-04-14CVE-2016-2037 - 1 byte out-of-bounds writePavel Raiskup5
Ensure that cpio_safer_name_suffix always works with dynamically allocated buffer, and that it has size of at least 32 bytes. Then, any call to cpio_safer_name_suffix is safe (it requires at least 2 bytes in the buffer). Also ensure that c_namesize is always correctly initialized (by cpio_set_c_name) to avoid undefined behavior when reading file_hdr.c_namesize (previously happened for tar archives). References: * src/copyin.c (query_rename): Drop the hack, as we now work with dynamically allocated buffer. Use cpio_set_c_name. (create_defered_links_to_skipped): Use cpio_set_c_name rather than manual assignment. (read_name_from_file): New function to avoid C&P. (read_in_old_ascii, read_in_new_ascii, read_in_binary): Use read_name_from_file. (process_copy_in): Initialize file_hdr.c_namesize. * src/copyout.c (process_copy_out): Use cpio_set_c_name. * src/cpiohdr.h (cpio_set_c_name): New prototype. * src/tar.c (read_in_tar_header): Use cpio_set_c_name. * src/util.c (cpio_set_c_name): New function to set file_hdr->c_name and c_namesize from arbitrary string. (cpio_safer_name_suffix): Some docs fixes. * tests/ Also test copy-in, and try various formats.
2017-02-06build: lint warnings in --device-independentPavel Raiskup1
Complements: 3945f9db44c935608caa5f0 * src/util.c (find_inode_val): Drop unused variable. (get_inode_and_dev): Function doesn't return any value, drop the return value in definition.
2017-01-02Update copyright yearsSergey Poznyakoff24
2016-11-10Fix the output of UTF8 file names in verbose mode.Sergey Poznyakoff2
* am/quoting.m4: New file. * Set default quoting style. * src/copyin.c (long_format): Use quotearg. (print_name_with_quoting): Remove. * src/extern.h (print_name_with_quoting): Remove proto.
2016-11-10Fix signed integer overflow - big block sizesgrajagandev1
2016-11-10Fix out-of-bounds readSergey Poznyakoff1
* src/copyin.c (process_copy_in): Skip records with zero filename length.
2015-09-12Update docs, use gettext 0.19.6Sergey Poznyakoff24
2015-09-01Include gnulib and paxutils as submodules.Sergey Poznyakoff2
* gnulib: New submodule. * paxutils: New submodule. * .gitignore: Updage * .gitmodules: Update * README-hacking: Update. * bootstrap: Install slightly modified version from the gnulib repo. * bootstrap.conf: Add paxutils-related stuff. * po/.gitignore: Update. * tests/ Fix expected output. * src/copyin.c: Tiny change. * src/util.c: Likewise.
2014-12-11Fix symlink-bad-length test for 64-bit architectures.Sergey Poznyakoff1
* src/util.c: Return non-zero exit code if EOF is hit prematurely. * tests/ Revert to original archive: there's no use testing for recovery, because that depends on the host architecture. Don't test for exit code as well (same reason). Account for eventual warning messages.
2014-12-11Fix error recovery in copy-in modeSergey Poznyakoff1
* src/copyin.c (copyin_link): Fix null dereference. (read_in_header): Fix error recovery (bug introduced by 27e0ae55). * tests/ Test error recovery. Catch various architecture-dependent error messages (suggested by Pavel Raiskup).
2014-12-02Fix typoSergey Poznyakoff1
2014-12-01BugfixSergey Poznyakoff1
* src/copyin.c (get_link_name): Fix range checking. * tests/ Change expected error message.
2014-12-01Fix memory overrun on reading improperly created link records.Sergey Poznyakoff1
See * src/copyin.c (get_link_name): New function. (list_file, copyin_link): use get_link_name * tests/ New file. * tests/ New file. * tests/ Add new files. * tests/ Likewise.
2014-12-01New options to create device and inode-independent archives.Sergey Poznyakoff4
* src/util.c (inode_val): New member trans_inode (find_inode_val): New function. (find_inode_file): Rewrite using the above. (add_inode): Initialize the trans_inode member depending on the value of renumber_inodes_option. (get_inode_and_dev): New function. (stat_to_cpio): Use get_inode_and_dev. (arf_stores_inode_p): New function. * src/extern.h (renumber_inodes_option) (ignore_devno_option): New externs. * src/global.c (renumber_inodes_option) (ignore_devno_option): New variables. * src/main.c: Add new options. * NEWS: Document changes. * doc/cpio.1: Document new options. * doc/cpio.texi: Likewise.
2014-01-30Update copyright years.Sergey Poznyakoff24
2014-01-30Treat UID/GID as numeric if prefixed by + (-R option)Sergey Poznyakoff1
The IDs supplied with the -R option are treated as numeric (without looking them up in the system database), when prefixed with +. This allows to force using numeric value if a user (group) with a numeric name exists in the database. Reported by Joshua Briefman <>. * src/userspec.c (parse_user_spec): Use + as an indicator of a numeric UID/GID. * doc/cpio.1: Document changes. * doc/cpio.texi: Likewise.
2014-01-30Use exit codes consistenly.Sergey Poznyakoff4
2014-01-30Improve documentation.Sergey Poznyakoff2
* .gitignore: Update. * NEWS: Update. * doc/cpio.1: Rewrite. * doc/cpio.texi: Major revamp. * src/main.c (options): Fix sectioning of the help output. (parse_opt): * src/util.c: Use PAXEXIT_FAILURE to indicate an error.
2014-01-28Distribute rmt.8; update build systemSergey Poznyakoff1
* NEWS: Update. * bootstrap (gnulib_extra_files): Remove "missing" * Do not distribute shar archive. Define CPIO_MT_COND * doc/ Always install manpages (mt.1 and rmt.8 -- depending on whether the corresponding programs are built). * doc/cpio.1: Update. * doc/mt.1: Update. * lib/ Use AM_CPPFLAGS instead of INCLUDES. * src/ Likewise. * tests/ Likewise.
2012-02-20Always use 32 bit CRCSergey Poznyakoff5
* src/cpiohdr.h (cpio_file_stat) <c_chksum>: Change type to uint32_t. * src/extern.h (crc): Change type to uint32_t. * src/global.c: Likewise. * src/copyout.c (read_for_checksum): Return uint32_t. * src/copyin.c: Fix printf formats.
2011-09-19Fix error handling in disk_empty_output_buffer and sparse_writeSergey Poznyakoff4
* src/extern.h (delayed_seek_count): Remove. (disk_empty_output_buffer): Change signature. * src/util.c (disk_empty_output_buffer): Take two arguments. Correctly handle partial writes (errno is not meaningful). (delayed_seek_count): Remove variable. (sparse_write): Change return type and signature. Rewrite. Return number actual number of bytes written or -1 on error. Check returns from lseek and write. * src/copyin.c (copyin_regular_file): Call disk_empty_output_buffer with flush=true before closing the file. * src/copypass.c (process_copy_pass): Likewise.
2011-09-18Minor fixes.Sergey Poznyakoff2
* Use gettext 0.18 * doc/.gitignore: Add parse-datetime.texi. * lib/ (libpax_a_SOURCES): Add exit-status.c * src/copyin.c (read_pattern_file): Use open_fatal if opening pattern file failed. * src/util.c (set_file_times): Use fdutimens.
2010-08-09Bugfixes.Sergey Poznyakoff1
* gnulib.modules: Add getline, required by rmt. * src/mt.c (fatal_exit): Change exit code to MT_EXIT_FAILURE.
2010-07-23Housekeeping.Sergey Poznyakoff2
* .gitignore: Sort. * src/cpiohdr.h: Fix indentation of preprocessor statements. * src/filetypes.h: Likewise.
2010-07-23Improve handling of -D in copy-pass mode.Sergey Poznyakoff1
* gnulib.modules: Add xgetcwd. * src/copypass.c (process_copy_pass): Convert directory_name to absolute if -D option was given.
2010-07-22Minor fix.Sergey Poznyakoff1
* src/filetypes.h: Remove declarations of stat and lstat.
2010-07-22Minor fixes.Sergey Poznyakoff2
* src/copyout.c (count_defered_links_to_dev_ino): Return size_t. (last_link): Do not use superfluous local variable. * src/util.c (copy_files_disk_to_tape) (copy_files_disk_to_disk): Shut down gcc warnings.
2010-07-22Minor changesSergey Poznyakoff1
* .gitignore: Update. * am/.gitignore: New file. * src/.gitignore: Add .gdbinit. * tests/ Fix keywords.
2010-07-22Provide a tar-like --directory (-D) option.Sergey Poznyakoff7
* src/copyin.c (process_copy_in): Call change_dir. * src/copyout.c (process_copy_out): Likewise. * src/copypass.c (process_copy_pass): Likewise. * src/extern.h (change_directory_option): New extern. (change_dir): New proto. * src/global.c (change_directory_option): New global. * src/main.c (options): New option --directory. (parse_opt): Handle the --directory option. * src/util.c (change_dir): New proto. * doc/cpio.texi: Document the --directory option.
2010-07-22Fix --to-stdout option supportDmitry V. Levin1
* src/copyin.c (copyin_link): Skip an appropriate number of bytes when to_stdout_option flag is set. * tests/ New test case. * tests/ (TESTSUITE_AT): Add * tests/ Include
2010-03-10Bugfixes.Sergey Poznyakoff2
* src/main.c (cpio_options): Remove unused options. * src/util.c (cpio_create_dir): Fix conditional. * NEWS: Update.
2010-02-12Use same code when creating directories in copy-in and copy-pass modes.Sergey Poznyakoff4
* src/copyin.c (copyin_mkdir): Remove. (copyin_directory): Remove. (copyin_file): Use cpio_create_dir instead of copyin_directory. * src/copypass.c (process_copy_pass): Use cpio_create_dir to create directories. * src/extern.h (delay_cpio_set_stat): New proto. * src/util.c (delay_cpio_set_stat): New function. (delay_set_stat): Rewrite as a wrapper to the above. (cpio_create_dir): New function. * tests/ Fix testcase. * tests/ Likewise. * tests/ New testcase. * tests/ New testcase. * tests/ New testcase. * tests/ Add new testcases. * tests/ Likewise.

Return to:

Send suggestions and report system problems to the System administrator.