From eff4ff4791c83686dfc7251c9ab3fe8ab9e60f0e Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Sun, 13 Oct 2024 10:34:11 +0200 Subject: [PATCH] Update vendor/libarchive to 3.7.7 Security fixes: #2364 tar: don't crash on truncated tar archives #2366 gzip: prevent a hang when processing a malformed gzip inside a gzip #2377 tar: fix two leaks in tar header parsing Important bugfixes: #2096 rar5: report encrypted entries #2252 7-zip: read/write symlink paths as UTF-8 #2360 tar: fix truncation of entry pathnames in specific archives Obtained from: libarchive Vendor commit: b439d586f53911c84be5e380445a8a259e19114c --- .cirrus.yml | 4 +- .github/workflows/ci.yml | 22 +- .github/workflows/cifuzz.yml | 2 +- .github/workflows/codeql.yml | 8 +- .github/workflows/scorecard.yml | 8 +- CMakeLists.txt | 8 + Makefile.am | 15 ++ NEWS | 2 + build/ci/github_actions/ci.cmd | 6 +- build/version | 2 +- cat/CMakeLists.txt | 3 + cat/bsdcat.1 | 24 +- cat/bsdcat.c | 22 +- cat/bsdcat.h | 22 +- cat/bsdcat_platform.h | 24 +- cat/cmdline.c | 22 +- cat/test/CMakeLists.txt | 3 + cat/test/test.h | 22 +- cat/test/test_0.c | 22 +- cat/test/test_empty_gz.c | 22 +- cat/test/test_empty_lz4.c | 22 +- cat/test/test_empty_xz.c | 22 +- cat/test/test_empty_zstd.c | 22 +- cat/test/test_error.c | 22 +- cat/test/test_error_mixed.c | 22 +- cat/test/test_expand_Z.c | 22 +- cat/test/test_expand_bz2.c | 22 +- cat/test/test_expand_gz.c | 22 +- cat/test/test_expand_lz4.c | 22 +- cat/test/test_expand_mixed.c | 22 +- cat/test/test_expand_plain.c | 22 +- cat/test/test_expand_xz.c | 22 +- cat/test/test_expand_zstd.c | 22 +- cat/test/test_help.c | 22 +- cat/test/test_stdin.c | 22 +- cat/test/test_version.c | 22 +- configure.ac | 53 ++--- cpio/CMakeLists.txt | 3 + cpio/bsdcpio.1 | 24 +- cpio/cmdline.c | 25 +-- cpio/config_freebsd.h | 22 +- cpio/cpio.c | 24 +- cpio/cpio.h | 22 +- cpio/cpio_platform.h | 22 +- cpio/cpio_windows.c | 22 +- cpio/cpio_windows.h | 22 +- cpio/test/CMakeLists.txt | 4 + cpio/test/test.h | 22 +- cpio/test/test_0.c | 22 +- cpio/test/test_basic.c | 22 +- cpio/test/test_cmdline.c | 22 +- cpio/test/test_extract_cpio_Z.c | 22 +- cpio/test/test_extract_cpio_absolute_paths.c | 53 +++++ cpio/test/test_extract_cpio_bz2.c | 22 +- cpio/test/test_extract_cpio_grz.c | 22 +- cpio/test/test_extract_cpio_gz.c | 22 +- cpio/test/test_extract_cpio_lrz.c | 22 +- cpio/test/test_extract_cpio_lz.c | 22 +- cpio/test/test_extract_cpio_lz4.c | 22 +- cpio/test/test_extract_cpio_lzma.c | 22 +- cpio/test/test_extract_cpio_lzo.c | 22 +- cpio/test/test_extract_cpio_xz.c | 22 +- cpio/test/test_extract_cpio_zstd.c | 22 +- cpio/test/test_format_newc.c | 28 +-- cpio/test/test_gcpio_compat.c | 22 +- cpio/test/test_missing_file.c | 22 +- cpio/test/test_option_0.c | 22 +- cpio/test/test_option_B_upper.c | 22 +- cpio/test/test_option_C_upper.c | 22 +- cpio/test/test_option_J_upper.c | 22 +- cpio/test/test_option_L_upper.c | 22 +- cpio/test/test_option_Z_upper.c | 22 +- cpio/test/test_option_a.c | 22 +- cpio/test/test_option_b64encode.c | 22 +- cpio/test/test_option_c.c | 22 +- cpio/test/test_option_d.c | 24 +- cpio/test/test_option_f.c | 22 +- cpio/test/test_option_grzip.c | 22 +- cpio/test/test_option_help.c | 22 +- cpio/test/test_option_l.c | 22 +- cpio/test/test_option_lrzip.c | 22 +- cpio/test/test_option_lz4.c | 22 +- cpio/test/test_option_lzma.c | 22 +- cpio/test/test_option_lzop.c | 22 +- cpio/test/test_option_m.c | 22 +- cpio/test/test_option_passphrase.c | 22 +- cpio/test/test_option_t.c | 22 +- cpio/test/test_option_u.c | 22 +- cpio/test/test_option_uuencode.c | 22 +- cpio/test/test_option_version.c | 22 +- cpio/test/test_option_xz.c | 22 +- cpio/test/test_option_y.c | 22 +- cpio/test/test_option_z.c | 22 +- cpio/test/test_option_zstd.c | 22 +- cpio/test/test_owner_parse.c | 22 +- cpio/test/test_passthrough_dotdot.c | 22 +- cpio/test/test_passthrough_reverse.c | 22 +- libarchive/archive.h | 4 +- libarchive/archive_acl.c | 20 +- libarchive/archive_cryptor.c | 4 +- libarchive/archive_cryptor_private.h | 2 +- libarchive/archive_entry.c | 4 +- libarchive/archive_entry.h | 2 +- libarchive/archive_entry_sparse.c | 2 +- libarchive/archive_entry_xattr.c | 2 +- libarchive/archive_hmac.c | 2 +- libarchive/archive_hmac_private.h | 2 +- libarchive/archive_match.c | 2 +- libarchive/archive_openssl_evp_private.h | 2 +- libarchive/archive_openssl_hmac_private.h | 2 +- libarchive/archive_ppmd7.c | 2 +- libarchive/archive_ppmd8.c | 2 +- libarchive/archive_private.h | 4 +- libarchive/archive_read.c | 6 +- libarchive/archive_read_append_filter.c | 6 +- libarchive/archive_read_disk_posix.c | 2 +- libarchive/archive_read_disk_windows.c | 29 ++- libarchive/archive_read_extract2.c | 2 +- libarchive/archive_read_open_fd.c | 2 +- libarchive/archive_read_open_file.c | 2 +- libarchive/archive_read_open_filename.c | 4 +- libarchive/archive_read_open_memory.c | 2 +- .../archive_read_support_filter_bzip2.c | 4 +- .../archive_read_support_filter_compress.c | 2 +- libarchive/archive_read_support_filter_gzip.c | 18 +- libarchive/archive_read_support_filter_lz4.c | 6 +- libarchive/archive_read_support_filter_lzop.c | 2 +- .../archive_read_support_filter_program.c | 6 +- libarchive/archive_read_support_filter_rpm.c | 2 +- libarchive/archive_read_support_filter_uu.c | 2 +- libarchive/archive_read_support_filter_xz.c | 4 +- libarchive/archive_read_support_filter_zstd.c | 4 +- libarchive/archive_read_support_format_7zip.c | 55 +++-- libarchive/archive_read_support_format_ar.c | 4 +- libarchive/archive_read_support_format_cab.c | 10 +- libarchive/archive_read_support_format_cpio.c | 4 +- .../archive_read_support_format_iso9660.c | 4 +- libarchive/archive_read_support_format_lha.c | 2 +- .../archive_read_support_format_mtree.c | 2 +- libarchive/archive_read_support_format_rar.c | 15 +- libarchive/archive_read_support_format_rar5.c | 95 ++++++-- libarchive/archive_read_support_format_raw.c | 2 +- libarchive/archive_read_support_format_tar.c | 207 ++++++++++-------- libarchive/archive_read_support_format_xar.c | 2 +- libarchive/archive_read_support_format_zip.c | 21 +- libarchive/archive_string.c | 2 +- libarchive/archive_util.c | 6 +- libarchive/archive_write.c | 8 +- .../archive_write_add_filter_b64encode.c | 2 +- libarchive/archive_write_add_filter_bzip2.c | 3 +- .../archive_write_add_filter_compress.c | 2 +- libarchive/archive_write_add_filter_gzip.c | 3 +- .../archive_write_add_filter_uuencode.c | 2 +- libarchive/archive_write_add_filter_xz.c | 3 +- libarchive/archive_write_add_filter_zstd.c | 3 +- libarchive/archive_write_disk_posix.c | 4 +- libarchive/archive_write_disk_windows.c | 51 +++-- libarchive/archive_write_open_fd.c | 2 +- libarchive/archive_write_open_file.c | 2 +- libarchive/archive_write_open_filename.c | 2 +- libarchive/archive_write_open_memory.c | 2 +- libarchive/archive_write_set_format_7zip.c | 16 +- libarchive/archive_write_set_format_ar.c | 6 +- .../archive_write_set_format_cpio_binary.c | 2 +- .../archive_write_set_format_cpio_newc.c | 2 +- .../archive_write_set_format_cpio_odc.c | 2 +- libarchive/archive_write_set_format_gnutar.c | 2 +- libarchive/archive_write_set_format_pax.c | 8 +- libarchive/archive_write_set_format_raw.c | 2 +- libarchive/archive_write_set_format_shar.c | 2 +- libarchive/archive_write_set_format_ustar.c | 2 +- libarchive/archive_write_set_format_v7tar.c | 2 +- libarchive/archive_write_set_format_zip.c | 2 +- libarchive/test/CMakeLists.txt | 4 + libarchive/test/test_7zip_filename_encoding.c | 100 +++++++++ .../test_archive_read_multiple_data_objects.c | 23 +- libarchive/test/test_archive_string.c | 2 +- .../test_archive_write_add_filter_by_name.c | 2 +- .../test/test_read_filter_gzip_recursive.c | 50 +++++ .../test_read_filter_gzip_recursive.gz.uu | 19 ++ .../test_read_format_rar4_encrypted.rar.uu | 10 + ...ead_format_rar4_encrypted_filenames.rar.uu | 14 ++ ...st_read_format_rar4_solid_encrypted.rar.uu | 11 + ...rmat_rar4_solid_encrypted_filenames.rar.uu | 13 ++ .../test_read_format_rar5_encrypted.rar.uu | 12 + ...ead_format_rar5_encrypted_filenames.rar.uu | 19 ++ ...st_read_format_rar5_solid_encrypted.rar.uu | 14 ++ ...rmat_rar5_solid_encrypted_filenames.rar.uu | 18 ++ .../test/test_read_format_rar_encryption.c | 176 +++++++++++++++ libarchive/test/test_read_format_xar.c | 6 +- libarchive/test/test_read_format_zip_nested.c | 2 +- libarchive/test/test_read_truncated_filter.c | 4 +- libarchive/test/test_sparse_basic.c | 17 +- libarchive/test/test_tar_large.c | 2 +- .../test_write_disk_secure_noabsolutepaths.c | 88 ++++++++ libarchive/test/test_write_filter_b64encode.c | 4 +- libarchive/test/test_write_filter_bzip2.c | 4 +- libarchive/test/test_write_filter_compress.c | 4 +- libarchive/test/test_write_filter_gzip.c | 4 +- .../test/test_write_filter_gzip_timestamp.c | 4 +- libarchive/test/test_write_filter_lrzip.c | 4 +- libarchive/test/test_write_filter_lz4.c | 8 +- libarchive/test/test_write_filter_lzip.c | 4 +- libarchive/test/test_write_filter_lzma.c | 4 +- libarchive/test/test_write_filter_lzop.c | 4 +- libarchive/test/test_write_filter_uuencode.c | 4 +- libarchive/test/test_write_filter_xz.c | 4 +- libarchive/test/test_write_filter_zstd.c | 4 +- .../test/test_write_format_iso9660_filename.c | 2 +- libarchive/test/test_write_format_zip_large.c | 2 +- .../test/test_write_format_zip_stream.c | 4 + tar/CMakeLists.txt | 3 + tar/bsdtar.1 | 24 +- tar/bsdtar.c | 22 +- tar/bsdtar.h | 22 +- tar/bsdtar_platform.h | 24 +- tar/bsdtar_windows.c | 22 +- tar/bsdtar_windows.h | 22 +- tar/cmdline.c | 22 +- tar/config_freebsd.h | 22 +- tar/creation_set.c | 24 +- tar/read.c | 22 +- tar/subst.c | 22 +- tar/test/CMakeLists.txt | 4 + tar/test/test.h | 22 +- tar/test/test_0.c | 22 +- tar/test/test_basic.c | 22 +- tar/test/test_copy.c | 22 +- tar/test/test_empty_mtree.c | 22 +- tar/test/test_extract_tar_Z.c | 22 +- tar/test/test_extract_tar_bz2.c | 22 +- tar/test/test_extract_tar_grz.c | 22 +- tar/test/test_extract_tar_gz.c | 22 +- tar/test/test_extract_tar_lrz.c | 22 +- tar/test/test_extract_tar_lz.c | 22 +- tar/test/test_extract_tar_lz4.c | 22 +- tar/test/test_extract_tar_lzma.c | 22 +- tar/test/test_extract_tar_lzo.c | 22 +- tar/test/test_extract_tar_xz.c | 22 +- tar/test/test_extract_tar_zstd.c | 22 +- tar/test/test_format_newc.c | 22 +- tar/test/test_help.c | 22 +- tar/test/test_leading_slash.c | 22 +- tar/test/test_missing_file.c | 22 +- tar/test/test_option_C_mtree.c | 30 +-- tar/test/test_option_C_upper.c | 22 +- tar/test/test_option_H_upper.c | 22 +- tar/test/test_option_L_upper.c | 22 +- tar/test/test_option_O_upper.c | 22 +- tar/test/test_option_P.c | 82 +++++++ tar/test/test_option_T_upper.c | 22 +- tar/test/test_option_U_upper.c | 22 +- tar/test/test_option_X_upper.c | 22 +- tar/test/test_option_a.c | 22 +- tar/test/test_option_acls.c | 22 +- tar/test/test_option_b.c | 22 +- tar/test/test_option_b64encode.c | 22 +- tar/test/test_option_exclude.c | 22 +- tar/test/test_option_exclude_vcs.c | 24 +- tar/test/test_option_fflags.c | 24 +- tar/test/test_option_gid_gname.c | 22 +- tar/test/test_option_group.c | 22 +- tar/test/test_option_grzip.c | 22 +- tar/test/test_option_ignore_zeros.c | 31 +-- tar/test/test_option_j.c | 22 +- tar/test/test_option_k.c | 22 +- tar/test/test_option_keep_newer_files.c | 22 +- tar/test/test_option_lrzip.c | 22 +- tar/test/test_option_lz4.c | 22 +- tar/test/test_option_lzma.c | 22 +- tar/test/test_option_lzop.c | 22 +- tar/test/test_option_n.c | 22 +- tar/test/test_option_newer_than.c | 22 +- tar/test/test_option_nodump.c | 22 +- tar/test/test_option_older_than.c | 22 +- tar/test/test_option_owner.c | 22 +- tar/test/test_option_passphrase.c | 22 +- tar/test/test_option_q.c | 22 +- tar/test/test_option_r.c | 22 +- tar/test/test_option_s.c | 22 +- tar/test/test_option_safe_writes.c | 22 +- tar/test/test_option_uid_uname.c | 22 +- tar/test/test_option_uuencode.c | 22 +- tar/test/test_option_xattrs.c | 24 +- tar/test/test_option_xz.c | 22 +- tar/test/test_option_z.c | 22 +- tar/test/test_option_zstd.c | 22 +- tar/test/test_patterns.c | 22 +- tar/test/test_print_longpath.c | 22 +- tar/test/test_stdio.c | 22 +- tar/test/test_strip_components.c | 22 +- tar/test/test_symlink_dir.c | 22 +- tar/test/test_version.c | 22 +- tar/test/test_windows.c | 22 +- tar/util.c | 22 +- tar/write.c | 27 +-- test_utils/test_common.h | 5 +- test_utils/test_main.c | 90 ++++---- unzip/CMakeLists.txt | 3 + unzip/bsdunzip.1 | 25 +-- unzip/bsdunzip.c | 28 --- unzip/bsdunzip.h | 22 +- unzip/bsdunzip_platform.h | 24 +- unzip/cmdline.c | 22 +- unzip/la_getline.c | 26 +-- unzip/test/test.h | 22 +- unzip/test/test_0.c | 22 +- unzip/test/test_C.c | 23 +- unzip/test/test_I.c | 23 +- unzip/test/test_L.c | 23 +- unzip/test/test_P_encryption.c | 23 +- unzip/test/test_Z1.c | 23 +- unzip/test/test_basic.c | 23 +- unzip/test/test_d.c | 23 +- unzip/test/test_doubledash.c | 23 +- unzip/test/test_glob.c | 23 +- unzip/test/test_j.c | 23 +- unzip/test/test_n.c | 23 +- unzip/test/test_not_exist.c | 23 +- unzip/test/test_o.c | 23 +- unzip/test/test_p.c | 23 +- unzip/test/test_q.c | 23 +- unzip/test/test_singlefile.c | 23 +- unzip/test/test_t.c | 23 +- unzip/test/test_t_bad.c | 23 +- unzip/test/test_version.c | 22 +- unzip/test/test_x.c | 23 +- 327 files changed, 1721 insertions(+), 4352 deletions(-) create mode 100644 cpio/test/test_extract_cpio_absolute_paths.c create mode 100644 libarchive/test/test_7zip_filename_encoding.c create mode 100644 libarchive/test/test_read_filter_gzip_recursive.c create mode 100644 libarchive/test/test_read_filter_gzip_recursive.gz.uu create mode 100644 libarchive/test/test_read_format_rar4_encrypted.rar.uu create mode 100644 libarchive/test/test_read_format_rar4_encrypted_filenames.rar.uu create mode 100644 libarchive/test/test_read_format_rar4_solid_encrypted.rar.uu create mode 100644 libarchive/test/test_read_format_rar4_solid_encrypted_filenames.rar.uu create mode 100644 libarchive/test/test_read_format_rar5_encrypted.rar.uu create mode 100644 libarchive/test/test_read_format_rar5_encrypted_filenames.rar.uu create mode 100644 libarchive/test/test_read_format_rar5_solid_encrypted.rar.uu create mode 100644 libarchive/test/test_read_format_rar5_solid_encrypted_filenames.rar.uu create mode 100644 libarchive/test/test_read_format_rar_encryption.c create mode 100644 libarchive/test/test_write_disk_secure_noabsolutepaths.c create mode 100644 tar/test/test_option_P.c diff --git a/.cirrus.yml b/.cirrus.yml index 02ea6fabb936..fe543e258fe8 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -10,9 +10,9 @@ FreeBSD_task: BS: cmake matrix: freebsd_instance: - image_family: freebsd-14-0 + image_family: freebsd-14-1 freebsd_instance: - image_family: freebsd-13-3 + image_family: freebsd-13-4 prepare_script: - ./build/ci/cirrus_ci/ci.sh prepare configure_script: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e6cdcaa0973..9ad62f5b41bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,12 @@ permissions: jobs: MacOS: - runs-on: macos-13 + runs-on: macos-15 strategy: matrix: bs: [autotools, cmake] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Install dependencies run: ./build/ci/github_actions/macos.sh prepare - name: Autogen @@ -45,19 +45,19 @@ jobs: run: ./build/ci/build.sh -a artifact env: BS: ${{ matrix.bs }} - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: libarchive-macos-${{ matrix.bs }}-${{ github.sha }} path: libarchive.tar.xz Ubuntu: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: bs: [autotools, cmake] crypto: [mbedtls, nettle, openssl] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Update apt cache run: sudo apt-get update - name: Install dependencies @@ -91,14 +91,14 @@ jobs: run: ./build/ci/build.sh -a artifact env: BS: ${{ matrix.bs }} - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: libarchive-ubuntu-${{ matrix.bs }}-${{ matrix.crypto }}-${{ github.sha }} path: libarchive.tar.xz Ubuntu-distcheck: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Update package definitions run: sudo apt-get update - name: Install dependencies @@ -113,7 +113,7 @@ jobs: SKIP_OPEN_FD_ERR_TEST: 1 - name: Dist-Artifact run: ./build/ci/build.sh -a dist-artifact - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: libarchive-${{ github.sha }} path: libarchive-dist.tar @@ -125,7 +125,7 @@ jobs: matrix: be: [mingw-gcc, msvc] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Install mingw if: ${{ matrix.be=='mingw-gcc' }} run: choco install mingw @@ -161,7 +161,7 @@ jobs: shell: cmd env: BE: ${{ matrix.be }} - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: libarchive-windows-${{ matrix.be }}-${{ github.sha }} path: libarchive.zip diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index ddacccc318cf..4777fab9c23e 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -21,7 +21,7 @@ jobs: fuzz-seconds: 600 dry-run: false - name: Upload Crash - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 if: failure() && steps.build.outcome == 'success' with: name: artifacts diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d9b6a373be06..3f596639a944 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -26,18 +26,18 @@ jobs: steps: - name: Checkout - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Initialize CodeQL - uses: github/codeql-action/init@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6 + uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6 + uses: github/codeql-action/autobuild@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6 + uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 with: category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index a5f452ca240b..60e9868344c3 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -29,12 +29,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif @@ -52,7 +52,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: SARIF file path: results.sarif @@ -60,6 +60,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6 + uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12 with: sarif_file: results.sarif diff --git a/CMakeLists.txt b/CMakeLists.txt index e23338e4df21..bfe68acd507b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -881,6 +881,14 @@ IF(NOT OPENSSL_FOUND) ENDIF(LIBMD_FOUND) ENDIF(NOT OPENSSL_FOUND) +# libbsd for readpassphrase on Haiku +IF("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku") + MESSAGE(STATUS "Adding libbsd for Haiku") + SET(CMAKE_REQUIRED_LIBRARIES "bsd") + FIND_LIBRARY(LIBBSD_LIBRARY NAMES bsd) + LIST(APPEND ADDITIONAL_LIBS ${LIBBSD_LIBRARY}) +ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku") + # # How to prove that CRYPTO functions, which have several names on various # platforms, just see if archive_digest.c can compile and link against diff --git a/Makefile.am b/Makefile.am index c978508d0b42..a36126c471d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -365,6 +365,7 @@ libarchive_test_SOURCES= \ $(test_utils_SOURCES) \ libarchive/test/read_open_memory.c \ libarchive/test/test.h \ + libarchive/test/test_7zip_filename_encoding.c \ libarchive/test/test_acl_nfs4.c \ libarchive/test/test_acl_pax.c \ libarchive/test/test_acl_platform_nfs4.c \ @@ -450,6 +451,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_file_nonexistent.c \ libarchive/test/test_read_filter_compress.c \ libarchive/test/test_read_filter_grzip.c \ + libarchive/test/test_read_filter_gzip_recursive.c \ libarchive/test/test_read_filter_lrzip.c \ libarchive/test/test_read_filter_lzop.c \ libarchive/test/test_read_filter_lzop_multiple_parts.c \ @@ -509,6 +511,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_mtree_crash747.c \ libarchive/test/test_read_format_pax_bz2.c \ libarchive/test/test_read_format_rar.c \ + libarchive/test/test_read_format_rar_encryption.c \ libarchive/test/test_read_format_rar_encryption_data.c \ libarchive/test/test_read_format_rar_encryption_partially.c \ libarchive/test/test_read_format_rar_encryption_header.c \ @@ -582,6 +585,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_write_disk_no_hfs_compression.c \ libarchive/test/test_write_disk_perms.c \ libarchive/test/test_write_disk_secure.c \ + libarchive/test/test_write_disk_secure_noabsolutepaths.c \ libarchive/test/test_write_disk_secure744.c \ libarchive/test/test_write_disk_secure745.c \ libarchive/test/test_write_disk_secure746.c \ @@ -756,6 +760,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_rar_multivolume_uncompressed_files.part09.rar.uu \ libarchive/test/test_rar_multivolume_uncompressed_files.part10.rar.uu \ libarchive/test/test_read_filter_grzip.tar.grz.uu \ + libarchive/test/test_read_filter_gzip_recursive.gz.uu \ libarchive/test/test_read_filter_lrzip.tar.lrz.uu \ libarchive/test/test_read_filter_lzop.tar.lzo.uu \ libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \ @@ -885,6 +890,14 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar_subblock.rar.uu \ libarchive/test/test_read_format_rar_unicode.rar.uu \ libarchive/test/test_read_format_rar_windows.rar.uu \ + libarchive/test/test_read_format_rar4_encrypted.rar.uu \ + libarchive/test/test_read_format_rar4_encrypted_filenames.rar.uu \ + libarchive/test/test_read_format_rar4_solid_encrypted.rar.uu \ + libarchive/test/test_read_format_rar4_solid_encrypted_filenames.rar.uu \ + libarchive/test/test_read_format_rar5_encrypted.rar.uu \ + libarchive/test/test_read_format_rar5_encrypted_filenames.rar.uu \ + libarchive/test/test_read_format_rar5_solid_encrypted.rar.uu \ + libarchive/test/test_read_format_rar5_solid_encrypted_filenames.rar.uu \ libarchive/test/test_read_format_rar5_arm.rar.uu \ libarchive/test/test_read_format_rar5_blake2.rar.uu \ libarchive/test/test_read_format_rar5_compressed.rar.uu \ @@ -1116,6 +1129,7 @@ bsdtar_test_SOURCES= \ tar/test/test_option_H_upper.c \ tar/test/test_option_L_upper.c \ tar/test/test_option_O_upper.c \ + tar/test/test_option_P.c \ tar/test/test_option_T_upper.c \ tar/test/test_option_U_upper.c \ tar/test/test_option_X_upper.c \ @@ -1266,6 +1280,7 @@ bsdcpio_test_SOURCES= \ cpio/test/test_basic.c \ cpio/test/test_cmdline.c \ cpio/test/test_extract_cpio_Z.c \ + cpio/test/test_extract_cpio_absolute_paths.c \ cpio/test/test_extract_cpio_bz2.c \ cpio/test/test_extract_cpio_grz.c \ cpio/test/test_extract_cpio_gz.c \ diff --git a/NEWS b/NEWS index 28303b2da84f..6af50e4e4033 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +Oct 13, 2024: libarchive 3.7.7 released + Sep 23, 2024: libarchive 3.7.6 released Sep 13, 2024: libarchive 3.7.5 released diff --git a/build/ci/github_actions/ci.cmd b/build/ci/github_actions/ci.cmd index 990475d1b8f0..515e6c732f83 100755 --- a/build/ci/github_actions/ci.cmd +++ b/build/ci/github_actions/ci.cmd @@ -138,10 +138,8 @@ IF "%1"=="deplibs" ( SET SKIP_TEST_SPARSE=1 mingw32-make test VERBOSE=1 || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( - ECHO "Skipping tests on this platform" - EXIT /b 0 - REM CD build_ci\cmake - REM cmake --build . --target RUN_TESTS --config Release || EXIT /b 1 + CD build_ci\cmake + cmake --build . --target RUN_TESTS --config Release || EXIT /b 1 ) ) ELSE IF "%1%"=="install" ( IF "%BE%"=="mingw-gcc" ( diff --git a/build/version b/build/version index be7fcfdc194b..56b5c9db9c6c 100644 --- a/build/version +++ b/build/version @@ -1 +1 @@ -3007006 +3007007 diff --git a/cat/CMakeLists.txt b/cat/CMakeLists.txt index 4fe6354b3131..8660aefb0b03 100644 --- a/cat/CMakeLists.txt +++ b/cat/CMakeLists.txt @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# ############################################ # # How to build bsdcat diff --git a/cat/bsdcat.1 b/cat/bsdcat.1 index 5d4944267ed4..b34a0c1c988d 100644 --- a/cat/bsdcat.1 +++ b/cat/bsdcat.1 @@ -1,27 +1,9 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2011-2014, Mike Kazantsev .\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" .Dd March 1, 2014 .Dt BSDCAT 1 .Os diff --git a/cat/bsdcat.c b/cat/bsdcat.c index 19d3de65cea4..731621fa9b75 100644 --- a/cat/bsdcat.c +++ b/cat/bsdcat.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2011-2014, Mike Kazantsev * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bsdcat_platform.h" diff --git a/cat/bsdcat.h b/cat/bsdcat.h index 504757a44040..6726f78e8453 100644 --- a/cat/bsdcat.h +++ b/cat/bsdcat.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014, Mike Kazantsev * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef BSDCAT_H_INCLUDED diff --git a/cat/bsdcat_platform.h b/cat/bsdcat_platform.h index 78a6113e6f01..940214f2ecd6 100644 --- a/cat/bsdcat_platform.h +++ b/cat/bsdcat_platform.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @@ -58,7 +40,7 @@ #define __LA_NORETURN __attribute__((__noreturn__)) #elif defined(_MSC_VER) #define __LA_NORETURN __declspec(noreturn) -#else +#else #define __LA_NORETURN #endif diff --git a/cat/cmdline.c b/cat/cmdline.c index 851b63de06e5..8ecd74aa95e4 100644 --- a/cat/cmdline.c +++ b/cat/cmdline.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* diff --git a/cat/test/CMakeLists.txt b/cat/test/CMakeLists.txt index 72f4a1037f89..4a9a0e1ecf25 100644 --- a/cat/test/CMakeLists.txt +++ b/cat/test/CMakeLists.txt @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# ############################################ # # How to build bsdtar_test diff --git a/cat/test/test.h b/cat/test/test.h index ec83d476b6b8..b852437ca430 100644 --- a/cat/test/test.h +++ b/cat/test/test.h @@ -1,26 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2006 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Every test program should #include "test.h" as the first thing. */ diff --git a/cat/test/test_0.c b/cat/test/test_0.c index c806c24356c0..07f5fc60cf35 100644 --- a/cat/test/test_0.c +++ b/cat/test/test_0.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_empty_gz.c b/cat/test/test_empty_gz.c index 6181f93b4d28..0ca835627bf5 100644 --- a/cat/test/test_empty_gz.c +++ b/cat/test/test_empty_gz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Sebastian Freundt * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_empty_lz4.c b/cat/test/test_empty_lz4.c index 9d98e9cfd390..ed4f2894fb4f 100644 --- a/cat/test/test_empty_lz4.c +++ b/cat/test/test_empty_lz4.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Sebastian Freundt * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_empty_xz.c b/cat/test/test_empty_xz.c index 368ffb574e50..591ab2410ce4 100644 --- a/cat/test/test_empty_xz.c +++ b/cat/test/test_empty_xz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Sebastian Freundt * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_empty_zstd.c b/cat/test/test_empty_zstd.c index c2d5ea106fa1..b0f25bf1cacd 100644 --- a/cat/test/test_empty_zstd.c +++ b/cat/test/test_empty_zstd.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Sean Purcell * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_error.c b/cat/test/test_error.c index 918af01be2dc..3e1a74a38820 100644 --- a/cat/test/test_error.c +++ b/cat/test/test_error.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_error_mixed.c b/cat/test/test_error_mixed.c index 7d94fce467aa..01cb9f0520dd 100644 --- a/cat/test/test_error_mixed.c +++ b/cat/test/test_error_mixed.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_Z.c b/cat/test/test_expand_Z.c index d48d4972ebee..f34f38ce0385 100644 --- a/cat/test/test_expand_Z.c +++ b/cat/test/test_expand_Z.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_bz2.c b/cat/test/test_expand_bz2.c index 82f074b341c8..8f3bb3f24a46 100644 --- a/cat/test/test_expand_bz2.c +++ b/cat/test/test_expand_bz2.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_gz.c b/cat/test/test_expand_gz.c index 18b715c66ebb..1f6f1cfddbac 100644 --- a/cat/test/test_expand_gz.c +++ b/cat/test/test_expand_gz.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_lz4.c b/cat/test/test_expand_lz4.c index 1b1d2106459d..efc2baad59ed 100644 --- a/cat/test/test_expand_lz4.c +++ b/cat/test/test_expand_lz4.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * Copyright (c) 2012, 2014 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_mixed.c b/cat/test/test_expand_mixed.c index fa2235719df6..eee22271af1b 100644 --- a/cat/test/test_expand_mixed.c +++ b/cat/test/test_expand_mixed.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_plain.c b/cat/test/test_expand_plain.c index 8b2276982885..15831105bb24 100644 --- a/cat/test/test_expand_plain.c +++ b/cat/test/test_expand_plain.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_xz.c b/cat/test/test_expand_xz.c index 99f87bf4c66b..050d14af2970 100644 --- a/cat/test/test_expand_xz.c +++ b/cat/test/test_expand_xz.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Mike Kazantsev * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_expand_zstd.c b/cat/test/test_expand_zstd.c index 23d918252ad1..a9ed1f127f91 100644 --- a/cat/test/test_expand_zstd.c +++ b/cat/test/test_expand_zstd.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Sean Purcell * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_help.c b/cat/test/test_help.c index 4ed47a076b29..25b5b4bf80ca 100644 --- a/cat/test/test_help.c +++ b/cat/test/test_help.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_stdin.c b/cat/test/test_stdin.c index cea5eb0ec1b3..93ee42310041 100644 --- a/cat/test/test_stdin.c +++ b/cat/test/test_stdin.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Sean Purcell * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cat/test/test_version.c b/cat/test/test_version.c index 51a4fd4d9a01..612282b7a2ff 100644 --- a/cat/test/test_version.c +++ b/cat/test/test_version.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2017 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/configure.ac b/configure.ac index 226ae2c9aa1b..9cdaee509496 100644 --- a/configure.ac +++ b/configure.ac @@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front. dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[3.7.6]) -m4_define([LIBARCHIVE_VERSION_N],[3007006]) +m4_define([LIBARCHIVE_VERSION_S],[3.7.7]) +m4_define([LIBARCHIVE_VERSION_N],[3007007]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) @@ -108,6 +108,11 @@ case "$host_os" in esac AC_SUBST(PLATFORMCPPFLAGS) +dnl Linking on Haiku needs libbsd because of readpassphrase +case "$host_os" in + haiku*) LIBS="-lbsd $LIBS" ;; +esac + # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O @@ -367,6 +372,7 @@ AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h]) AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h]) AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h]) AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) +AC_CHECK_TYPE([suseconds_t]) AC_CHECK_HEADERS([windows.h]) # check windows.h first; the other headers require it. AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], @@ -923,9 +929,7 @@ if test "x$enable_xattr" != "xno"; then listxattr \ setxattr, [ac_cv_archive_xattr_darwin=yes], - [ac_cv_archive_xattr_darwin=no], - [#include -]) + [ac_cv_archive_xattr_darwin=no]) ] ) elif test "x$ac_cv_header_sys_extattr_h" = "xyes" \ @@ -941,10 +945,7 @@ if test "x$enable_xattr" != "xno"; then extattr_set_fd \ extattr_set_link, [ac_cv_archive_xattr_freebsd=yes], - [ac_cv_archive_xattr_freebsd=no], - [#include -#include -]) + [ac_cv_archive_xattr_freebsd=no]) ] ) elif test "x$ac_cv_header_sys_xattr_h" = "xyes" \ @@ -960,17 +961,7 @@ if test "x$enable_xattr" != "xno"; then llistxattr \ lsetxattr, [ac_cv_archive_xattr_linux=yes], - [ac_cv_archive_xattr_linux=no], - [#if HAVE_SYS_TYPES_H -#include -#endif -#if HAVE_SYS_XATTR_H -#include -#endif -#if HAVE_ATTR_XATTR_H -#include -#endif -]) + [ac_cv_archive_xattr_linux=no]) ] ) elif test "x$ac_cv_header_sys_ea_h" = "xyes"; then @@ -985,9 +976,7 @@ if test "x$enable_xattr" != "xno"; then llistea \ lsetea, [ac_cv_archive_xattr_aix=yes], - [ac_cv_archive_xattr_aix=no], - [#include -]) + [ac_cv_archive_xattr_aix=no]) ] ) fi @@ -1056,7 +1045,7 @@ if test "x$enable_acl" != "xno"; then richacl_get_file \ richacl_set_fd \ richacl_set_file, - [ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no], [#include ])]) + [ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no])]) fi if test "x$ac_cv_func_acl" = "xyes" \ @@ -1098,14 +1087,7 @@ if test "x$enable_acl" != "xno"; then acl_set_file \ acl_set_qualifier \ acl_set_tag_type, - [ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no], - [#if HAVE_SYS_TYPES_H - #include - #endif - #if HAVE_SYS_ACL_H - #include - #endif - ]) + [ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no]) ]) AC_CHECK_FUNCS(acl_get_perm) @@ -1132,14 +1114,11 @@ if test "x$enable_acl" != "xno"; then acl_is_trivial_np \ acl_set_entry_type_np \ acl_set_fd_np \ - acl_set_link_np,,, - [#include - #include ]) + acl_set_link_np) AC_CHECK_FUNCS(mbr_uid_to_uuid \ mbr_uuid_to_id \ - mbr_gid_to_uuid,,, - [#include ]) + mbr_gid_to_uuid) AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_TYPE_NFS4, ACL_USER, ACL_SYNCHRONIZE], [], [], diff --git a/cpio/CMakeLists.txt b/cpio/CMakeLists.txt index 85fda7782800..f867bdf95f62 100644 --- a/cpio/CMakeLists.txt +++ b/cpio/CMakeLists.txt @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# ############################################ # # How to build bsdcpio diff --git a/cpio/bsdcpio.1 b/cpio/bsdcpio.1 index c52764a8c4f7..9dc7d660b448 100644 --- a/cpio/bsdcpio.1 +++ b/cpio/bsdcpio.1 @@ -1,27 +1,9 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2003-2007 Tim Kientzle .\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" .Dd September 16, 2014 .Dt CPIO 1 .Os diff --git a/cpio/cmdline.c b/cpio/cmdline.c index 0f26c51739b2..c67519947dbc 100644 --- a/cpio/cmdline.c +++ b/cpio/cmdline.c @@ -1,27 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -350,7 +331,7 @@ owner_parse(const char *spec, struct cpio_owner *owner, const char **errmsg) char *user; struct passwd *pwent; - user = (char *)malloc(ue - u + 1); + user = malloc(ue - u + 1); if (user == NULL) goto alloc_error; memcpy(user, u, ue - u); diff --git a/cpio/config_freebsd.h b/cpio/config_freebsd.h index 1cba09653cb5..ab7f7d55c120 100644 --- a/cpio/config_freebsd.h +++ b/cpio/config_freebsd.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* A hand-tooled configuration for FreeBSD. */ diff --git a/cpio/cpio.c b/cpio/cpio.c index d4d9ac88555f..6bc6eb22e967 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -1,27 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -1032,6 +1013,7 @@ mode_in(struct cpio *cpio) fprintf(stderr, "%s: %s\n", archive_entry_pathname(entry), archive_error_string(ext)); + cpio->return_value = 1; } else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) { r = extract_data(a, ext); diff --git a/cpio/cpio.h b/cpio/cpio.h index 3608268f12a9..9bc631b544fe 100644 --- a/cpio/cpio.h +++ b/cpio/cpio.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CPIO_H_INCLUDED diff --git a/cpio/cpio_platform.h b/cpio/cpio_platform.h index 263404b40dab..c097fc62c58d 100644 --- a/cpio/cpio_platform.h +++ b/cpio/cpio_platform.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* diff --git a/cpio/cpio_windows.c b/cpio/cpio_windows.c index c888a3897d56..a619c6889bd9 100644 --- a/cpio/cpio_windows.c +++ b/cpio/cpio_windows.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2009 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if defined(_WIN32) && !defined(__CYGWIN__) diff --git a/cpio/cpio_windows.h b/cpio/cpio_windows.h index 6b88c389ab40..173a1e5e2a6c 100644 --- a/cpio/cpio_windows.h +++ b/cpio/cpio_windows.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2009 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CPIO_WINDOWS_H #define CPIO_WINDOWS_H 1 diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt index 2c3fbb0a8af5..a3e912fb0f65 100644 --- a/cpio/test/CMakeLists.txt +++ b/cpio/test/CMakeLists.txt @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# ############################################ # # How to build bsdcpio_test @@ -14,6 +17,7 @@ IF(ENABLE_CPIO AND ENABLE_TEST) test_basic.c test_cmdline.c test_extract_cpio_Z.c + test_extract_cpio_absolute_paths.c test_extract_cpio_bz2.c test_extract_cpio_grz.c test_extract_cpio_gz.c diff --git a/cpio/test/test.h b/cpio/test/test.h index f8f3a4038b57..1bbbb9d40d66 100644 --- a/cpio/test/test.h +++ b/cpio/test/test.h @@ -1,26 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2017 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Every test program should #include "test.h" as the first thing. */ diff --git a/cpio/test/test_0.c b/cpio/test/test_0.c index c09df5e137c4..f6166456a6a0 100644 --- a/cpio/test/test_0.c +++ b/cpio/test/test_0.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_basic.c b/cpio/test/test_basic.c index 993d555b831c..8b8e8bb0f0ec 100644 --- a/cpio/test/test_basic.c +++ b/cpio/test/test_basic.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_cmdline.c b/cpio/test/test_cmdline.c index f4e05ee58599..e4397b14e7f6 100644 --- a/cpio/test/test_cmdline.c +++ b/cpio/test/test_cmdline.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_Z.c b/cpio/test/test_extract_cpio_Z.c index 257d70d04211..31fc271a5674 100644 --- a/cpio/test/test_extract_cpio_Z.c +++ b/cpio/test/test_extract_cpio_Z.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_absolute_paths.c b/cpio/test/test_extract_cpio_absolute_paths.c new file mode 100644 index 000000000000..66fc56641bd0 --- /dev/null +++ b/cpio/test/test_extract_cpio_absolute_paths.c @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Mostyn Bramley-Moore + */ + +#include "test.h" + +#include +#include + +#if defined(_WIN32) && !defined(__CYGWIN__) +#define UNLINK _unlink +#else +#define UNLINK unlink +#endif + +DEFINE_TEST(test_extract_cpio_absolute_paths) +{ + int r; + + // Create an absolute path for a test file inside testworkdir. + char *entry_suffix = "/cpio-noabs"; + size_t entry_suffix_length = strlen(entry_suffix); + size_t testworkdir_length = strlen(testworkdir); + size_t temp_absolute_file_name_length = testworkdir_length + entry_suffix_length; + char *temp_absolute_file_name = calloc(1, temp_absolute_file_name_length + 1); // +1 for null character. + assertEqualInt(snprintf(temp_absolute_file_name, temp_absolute_file_name_length + 1, "%s%s", testworkdir, entry_suffix), + temp_absolute_file_name_length); + + // Create the file. + const char *sample_data = "test file from test_extract_cpio_absolute_paths"; + assertMakeFile(temp_absolute_file_name, 0644, sample_data); + + // Create an archive with the test file, using an absolute path. + assertMakeFile("filelist", 0644, temp_absolute_file_name); + r = systemf("%s -o < filelist > archive.cpio 2> stderr1.txt", testprog); + assertEqualInt(r, 0); + + // Ensure that the temp file does not exist. + UNLINK(temp_absolute_file_name); + + // We should refuse to create the absolute path without --insecure. + r = systemf("%s -i < archive.cpio 2> stderr2.txt", testprog); + assert(r != 0); + assertFileNotExists(temp_absolute_file_name); + UNLINK(temp_absolute_file_name); // Cleanup just in case. + + // But if we specify --insecure then the absolute path should be created. + r = systemf("%s -i --insecure < archive.cpio 2> stderr3.txt", testprog); + assert(r == 0); + assertFileExists(temp_absolute_file_name); +} diff --git a/cpio/test/test_extract_cpio_bz2.c b/cpio/test/test_extract_cpio_bz2.c index 08fe1fe53468..b66c08271837 100644 --- a/cpio/test/test_extract_cpio_bz2.c +++ b/cpio/test/test_extract_cpio_bz2.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_grz.c b/cpio/test/test_extract_cpio_grz.c index 969b30e44de5..8cd3583e909d 100644 --- a/cpio/test/test_extract_cpio_grz.c +++ b/cpio/test/test_extract_cpio_grz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_gz.c b/cpio/test/test_extract_cpio_gz.c index 16296146f87e..bc1bd48df44a 100644 --- a/cpio/test/test_extract_cpio_gz.c +++ b/cpio/test/test_extract_cpio_gz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_lrz.c b/cpio/test/test_extract_cpio_lrz.c index 7ef213f74aac..fd124b29475c 100644 --- a/cpio/test/test_extract_cpio_lrz.c +++ b/cpio/test/test_extract_cpio_lrz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_lz.c b/cpio/test/test_extract_cpio_lz.c index bfdf87869b37..deacbbfbb9ba 100644 --- a/cpio/test/test_extract_cpio_lz.c +++ b/cpio/test/test_extract_cpio_lz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_lz4.c b/cpio/test/test_extract_cpio_lz4.c index f8cf5f8fab0d..06bd5f021246 100644 --- a/cpio/test/test_extract_cpio_lz4.c +++ b/cpio/test/test_extract_cpio_lz4.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012,2014 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_lzma.c b/cpio/test/test_extract_cpio_lzma.c index 81fc3c236ab5..6d2f76fc855d 100644 --- a/cpio/test/test_extract_cpio_lzma.c +++ b/cpio/test/test_extract_cpio_lzma.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_lzo.c b/cpio/test/test_extract_cpio_lzo.c index d54d4f712374..43f9dce1ce4b 100644 --- a/cpio/test/test_extract_cpio_lzo.c +++ b/cpio/test/test_extract_cpio_lzo.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_xz.c b/cpio/test/test_extract_cpio_xz.c index faeea202e050..bdf8e8d918e9 100644 --- a/cpio/test/test_extract_cpio_xz.c +++ b/cpio/test/test_extract_cpio_xz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_extract_cpio_zstd.c b/cpio/test/test_extract_cpio_zstd.c index 31421c3b60d7..67428813e6b4 100644 --- a/cpio/test/test_extract_cpio_zstd.c +++ b/cpio/test/test_extract_cpio_zstd.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Sean Purcell * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_format_newc.c b/cpio/test/test_format_newc.c index ee0087d4ca94..884b6c9c4da7 100644 --- a/cpio/test/test_format_newc.c +++ b/cpio/test/test_format_newc.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" @@ -194,11 +176,11 @@ DEFINE_TEST(test_format_newc) assertEqualMem(e + 0, "070701", 6); /* Magic */ ino = from_hex(e + 6, 8); /* ino */ #if defined(_WIN32) && !defined(__CYGWIN__) - /* Group members bits and others bits do not work. */ + /* Group members bits and others bits do not work. */ assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */ #else assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */ -#endif +#endif #if defined(_WIN32) uid = from_hex(e + 22, 8); #else @@ -308,7 +290,7 @@ DEFINE_TEST(test_format_newc) failure("If these aren't the same, then the hardlink detection failed to match them."); assertEqualInt(ino, from_hex(e + 6, 8)); /* ino */ #if defined(_WIN32) && !defined(__CYGWIN__) - /* Group members bits and others bits do not work. */ + /* Group members bits and others bits do not work. */ assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */ #else assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */ diff --git a/cpio/test/test_gcpio_compat.c b/cpio/test/test_gcpio_compat.c index 82c71ec3cd21..1765df6f058e 100644 --- a/cpio/test/test_gcpio_compat.c +++ b/cpio/test/test_gcpio_compat.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_missing_file.c b/cpio/test/test_missing_file.c index 784d53cfe141..a9e8d6ba20ca 100644 --- a/cpio/test/test_missing_file.c +++ b/cpio/test/test_missing_file.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_0.c b/cpio/test/test_option_0.c index fbe6f7ac4a85..76a2fae5c214 100644 --- a/cpio/test/test_option_0.c +++ b/cpio/test/test_option_0.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_B_upper.c b/cpio/test/test_option_B_upper.c index 79dc91efb5ba..873220d991e4 100644 --- a/cpio/test/test_option_B_upper.c +++ b/cpio/test/test_option_B_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_C_upper.c b/cpio/test/test_option_C_upper.c index f9fd7e159339..9c854daebfb7 100644 --- a/cpio/test/test_option_C_upper.c +++ b/cpio/test/test_option_C_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_J_upper.c b/cpio/test/test_option_J_upper.c index f76d3b236913..1982267c79f5 100644 --- a/cpio/test/test_option_J_upper.c +++ b/cpio/test/test_option_J_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_L_upper.c b/cpio/test/test_option_L_upper.c index b6fb713f110f..1854b1d944e5 100644 --- a/cpio/test/test_option_L_upper.c +++ b/cpio/test/test_option_L_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_Z_upper.c b/cpio/test/test_option_Z_upper.c index aa408e4e548c..15f88944aa39 100644 --- a/cpio/test/test_option_Z_upper.c +++ b/cpio/test/test_option_Z_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_a.c b/cpio/test/test_option_a.c index 885eb12c80f5..e6b87948c65a 100644 --- a/cpio/test/test_option_a.c +++ b/cpio/test/test_option_a.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" #if defined(HAVE_UTIME_H) diff --git a/cpio/test/test_option_b64encode.c b/cpio/test/test_option_b64encode.c index 501976c202a1..721a4a33c977 100644 --- a/cpio/test/test_option_b64encode.c +++ b/cpio/test/test_option_b64encode.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_c.c b/cpio/test/test_option_c.c index de25ed1ab52d..e8748449514b 100644 --- a/cpio/test/test_option_c.c +++ b/cpio/test/test_option_c.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_d.c b/cpio/test/test_option_d.c index b96430e4f37a..3ad6c0bd6dd8 100644 --- a/cpio/test/test_option_d.c +++ b/cpio/test/test_option_d.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" @@ -44,7 +26,7 @@ DEFINE_TEST(test_option_d) assertMakeDir("without-d", 0755); assertChdir("without-d"); r = systemf("%s -i < ../archive.cpio >out 2>err", testprog); - assertEqualInt(r, 0); + assert(r != 0); assertEmptyFile("out"); /* And the file should not be restored. */ assertFileNotExists("dir/file"); diff --git a/cpio/test/test_option_f.c b/cpio/test/test_option_f.c index 72383884ac1e..ee09b778a84c 100644 --- a/cpio/test/test_option_f.c +++ b/cpio/test/test_option_f.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_grzip.c b/cpio/test/test_option_grzip.c index cd898cd9228f..6bf12b7de84b 100644 --- a/cpio/test/test_option_grzip.c +++ b/cpio/test/test_option_grzip.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_help.c b/cpio/test/test_option_help.c index cf69c76496d5..ff64d27b759d 100644 --- a/cpio/test/test_option_help.c +++ b/cpio/test/test_option_help.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_l.c b/cpio/test/test_option_l.c index 3f4390a6ff22..bbd54c7bc972 100644 --- a/cpio/test/test_option_l.c +++ b/cpio/test/test_option_l.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_lrzip.c b/cpio/test/test_option_lrzip.c index 4c46f1c65bba..8854039de0f1 100644 --- a/cpio/test/test_option_lrzip.c +++ b/cpio/test/test_option_lrzip.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_lz4.c b/cpio/test/test_option_lz4.c index 4c5186d55ccc..17b20e334e2b 100644 --- a/cpio/test/test_option_lz4.c +++ b/cpio/test/test_option_lz4.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_lzma.c b/cpio/test/test_option_lzma.c index 3c2648b827cd..0961a0c0b569 100644 --- a/cpio/test/test_option_lzma.c +++ b/cpio/test/test_option_lzma.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_lzop.c b/cpio/test/test_option_lzop.c index b787b720a878..66afeb56c903 100644 --- a/cpio/test/test_option_lzop.c +++ b/cpio/test/test_option_lzop.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_m.c b/cpio/test/test_option_m.c index f2f297e10572..4cb7e354cee4 100644 --- a/cpio/test/test_option_m.c +++ b/cpio/test/test_option_m.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_passphrase.c b/cpio/test/test_option_passphrase.c index d409b30c81cf..28818cb6f05c 100644 --- a/cpio/test/test_option_passphrase.c +++ b/cpio/test/test_option_passphrase.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_t.c b/cpio/test/test_option_t.c index 46668ec276b8..c7ee64341efd 100644 --- a/cpio/test/test_option_t.c +++ b/cpio/test/test_option_t.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_u.c b/cpio/test/test_option_u.c index fe5b863af0e2..4c00e88cfe7a 100644 --- a/cpio/test/test_option_u.c +++ b/cpio/test/test_option_u.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" #if defined(HAVE_UTIME_H) diff --git a/cpio/test/test_option_uuencode.c b/cpio/test/test_option_uuencode.c index 28662ddfb659..76966602b7a7 100644 --- a/cpio/test/test_option_uuencode.c +++ b/cpio/test/test_option_uuencode.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_version.c b/cpio/test/test_option_version.c index 505db27128fe..4992295ae17a 100644 --- a/cpio/test/test_option_version.c +++ b/cpio/test/test_option_version.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2017 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_xz.c b/cpio/test/test_option_xz.c index 9116ecace3a7..cc91fd566ad5 100644 --- a/cpio/test/test_option_xz.c +++ b/cpio/test/test_option_xz.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_y.c b/cpio/test/test_option_y.c index a78dff8cf4ea..fd1a947c0649 100644 --- a/cpio/test/test_option_y.c +++ b/cpio/test/test_option_y.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_z.c b/cpio/test/test_option_z.c index 9a1500d77f32..e89d8f8ea62c 100644 --- a/cpio/test/test_option_z.c +++ b/cpio/test/test_option_z.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_option_zstd.c b/cpio/test/test_option_zstd.c index 10c3ed9784e8..50ec458d0993 100644 --- a/cpio/test/test_option_zstd.c +++ b/cpio/test/test_option_zstd.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Sean Purcell * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_owner_parse.c b/cpio/test/test_owner_parse.c index 6fa850fa2691..dfc78ca77aec 100644 --- a/cpio/test/test_owner_parse.c +++ b/cpio/test/test_owner_parse.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_passthrough_dotdot.c b/cpio/test/test_passthrough_dotdot.c index 831c1f81c1cb..bd77190fbf62 100644 --- a/cpio/test/test_passthrough_dotdot.c +++ b/cpio/test/test_passthrough_dotdot.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/cpio/test/test_passthrough_reverse.c b/cpio/test/test_passthrough_reverse.c index 7ae0e6602a34..9e58b618060f 100644 --- a/cpio/test/test_passthrough_reverse.c +++ b/cpio/test/test_passthrough_reverse.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/libarchive/archive.h b/libarchive/archive.h index aeddc816a251..5b65475f61e2 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -34,7 +34,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3007006 +#define ARCHIVE_VERSION_NUMBER 3007007 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.7.6" +#define ARCHIVE_VERSION_ONLY_STRING "3.7.7" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); diff --git a/libarchive/archive_acl.c b/libarchive/archive_acl.c index 77d99480f96b..bbb085afe7af 100644 --- a/libarchive/archive_acl.c +++ b/libarchive/archive_acl.c @@ -56,7 +56,7 @@ static int archive_acl_add_entry_len_l(struct archive_acl *acl, int type, int permset, int tag, int id, const char *name, size_t len, struct archive_string_conv *sc); static int archive_acl_text_want_type(struct archive_acl *acl, int flags); -static ssize_t archive_acl_text_len(struct archive_acl *acl, int want_type, +static size_t archive_acl_text_len(struct archive_acl *acl, int want_type, int flags, int wide, struct archive *a, struct archive_string_conv *sc); static int isint_w(const wchar_t *start, const wchar_t *end, int *result); @@ -346,7 +346,7 @@ acl_new_entry(struct archive_acl *acl, } /* Add a new entry to the end of the list. */ - ap = (struct archive_acl_entry *)calloc(1, sizeof(*ap)); + ap = calloc(1, sizeof(*ap)); if (ap == NULL) return (NULL); if (aq == NULL) @@ -528,14 +528,14 @@ archive_acl_text_want_type(struct archive_acl *acl, int flags) /* * Calculate ACL text string length */ -static ssize_t +static size_t archive_acl_text_len(struct archive_acl *acl, int want_type, int flags, int wide, struct archive *a, struct archive_string_conv *sc) { struct archive_acl_entry *ap; const char *name; const wchar_t *wname; int count, idlen, tmp, r; - ssize_t length; + size_t length; size_t len; count = 0; @@ -664,7 +664,7 @@ archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, struct archive *a) { int count; - ssize_t length; + size_t length; size_t len; const wchar_t *wname; const wchar_t *prefix; @@ -693,7 +693,7 @@ archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, separator = L'\n'; /* Now, allocate the string and actually populate it. */ - wp = ws = (wchar_t *)malloc(length * sizeof(wchar_t)); + wp = ws = malloc(length * sizeof(*wp)); if (wp == NULL) { if (errno == ENOMEM) __archive_errx(1, "No memory"); @@ -755,7 +755,7 @@ archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, len = wcslen(ws); - if ((ssize_t)len > (length - 1)) + if (len > length - 1) __archive_errx(1, "Buffer overrun"); if (text_len != NULL) @@ -897,7 +897,7 @@ archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, struct archive_string_conv *sc) { int count; - ssize_t length; + size_t length; size_t len; const char *name; const char *prefix; @@ -926,7 +926,7 @@ archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, separator = '\n'; /* Now, allocate the string and actually populate it. */ - p = s = (char *)malloc(length * sizeof(char)); + p = s = malloc(length * sizeof(*p)); if (p == NULL) { if (errno == ENOMEM) __archive_errx(1, "No memory"); @@ -990,7 +990,7 @@ archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, len = strlen(s); - if ((ssize_t)len > (length - 1)) + if (len > length - 1) __archive_errx(1, "Buffer overrun"); if (text_len != NULL) diff --git a/libarchive/archive_cryptor.c b/libarchive/archive_cryptor.c index 437dba06be62..1825af4dc510 100644 --- a/libarchive/archive_cryptor.c +++ b/libarchive/archive_cryptor.c @@ -57,7 +57,7 @@ pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt, return 0; } -#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA #ifdef _MSC_VER #pragma comment(lib, "Bcrypt.lib") #endif @@ -197,7 +197,7 @@ aes_ctr_release(archive_crypto_ctx *ctx) return 0; } -#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA static int aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) diff --git a/libarchive/archive_cryptor_private.h b/libarchive/archive_cryptor_private.h index 16b6d16ff23c..c13f29260a07 100644 --- a/libarchive/archive_cryptor_private.h +++ b/libarchive/archive_cryptor_private.h @@ -62,7 +62,7 @@ typedef struct { unsigned encr_pos; } archive_crypto_ctx; -#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA #include /* Common in other bcrypt implementations, but missing from VS2008. */ diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c index f68fee65d521..4ebfc5fa6323 100644 --- a/libarchive/archive_entry.c +++ b/libarchive/archive_entry.c @@ -263,7 +263,7 @@ archive_entry_new2(struct archive *a) { struct archive_entry *entry; - entry = (struct archive_entry *)calloc(1, sizeof(*entry)); + entry = calloc(1, sizeof(*entry)); if (entry == NULL) return (NULL); entry->archive = a; @@ -2095,7 +2095,7 @@ ae_fflagstostr(unsigned long bitset, unsigned long bitclear) if (length == 0) return (NULL); - string = (char *)malloc(length); + string = malloc(length); if (string == NULL) return (NULL); diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index c054849be095..97f5cdafbf90 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -28,7 +28,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3007006 +#define ARCHIVE_VERSION_NUMBER 3007007 /* * Note: archive_entry.h is for use outside of libarchive; the diff --git a/libarchive/archive_entry_sparse.c b/libarchive/archive_entry_sparse.c index b81684d18730..c430896119fb 100644 --- a/libarchive/archive_entry_sparse.c +++ b/libarchive/archive_entry_sparse.c @@ -76,7 +76,7 @@ archive_entry_sparse_add_entry(struct archive_entry *entry, } } - if ((sp = (struct ae_sparse *)malloc(sizeof(*sp))) == NULL) + if ((sp = malloc(sizeof(*sp))) == NULL) /* XXX Error XXX */ return; diff --git a/libarchive/archive_entry_xattr.c b/libarchive/archive_entry_xattr.c index 14848a5ab2c4..b92e1878bc43 100644 --- a/libarchive/archive_entry_xattr.c +++ b/libarchive/archive_entry_xattr.c @@ -90,7 +90,7 @@ archive_entry_xattr_add_entry(struct archive_entry *entry, { struct ae_xattr *xp; - if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL) + if ((xp = malloc(sizeof(struct ae_xattr))) == NULL) __archive_errx(1, "Out of memory"); if ((xp->name = strdup(name)) == NULL) diff --git a/libarchive/archive_hmac.c b/libarchive/archive_hmac.c index edb3bf5abd42..210cca70744d 100644 --- a/libarchive/archive_hmac.c +++ b/libarchive/archive_hmac.c @@ -74,7 +74,7 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) memset(ctx, 0, sizeof(*ctx)); } -#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA #ifndef BCRYPT_HASH_REUSABLE_FLAG # define BCRYPT_HASH_REUSABLE_FLAG 0x00000020 diff --git a/libarchive/archive_hmac_private.h b/libarchive/archive_hmac_private.h index d0fda7f9667a..1b24ddd1bc94 100644 --- a/libarchive/archive_hmac_private.h +++ b/libarchive/archive_hmac_private.h @@ -52,7 +52,7 @@ int __libarchive_hmac_build_hack(void); typedef CCHmacContext archive_hmac_sha1_ctx; -#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA #include typedef struct { diff --git a/libarchive/archive_match.c b/libarchive/archive_match.c index 3ab8eda36038..446417a9a2d4 100644 --- a/libarchive/archive_match.c +++ b/libarchive/archive_match.c @@ -220,7 +220,7 @@ archive_match_new(void) { struct archive_match *a; - a = (struct archive_match *)calloc(1, sizeof(*a)); + a = calloc(1, sizeof(*a)); if (a == NULL) return (NULL); a->archive.magic = ARCHIVE_MATCH_MAGIC; diff --git a/libarchive/archive_openssl_evp_private.h b/libarchive/archive_openssl_evp_private.h index 8ac4772808e6..d5ba7b0d60db 100644 --- a/libarchive/archive_openssl_evp_private.h +++ b/libarchive/archive_openssl_evp_private.h @@ -39,7 +39,7 @@ #include /* memset */ static inline EVP_MD_CTX *EVP_MD_CTX_new(void) { - EVP_MD_CTX *ctx = (EVP_MD_CTX *)calloc(1, sizeof(EVP_MD_CTX)); + EVP_MD_CTX *ctx = calloc(1, sizeof(EVP_MD_CTX)); return ctx; } diff --git a/libarchive/archive_openssl_hmac_private.h b/libarchive/archive_openssl_hmac_private.h index 25c8dda654fc..8ed76260dde9 100644 --- a/libarchive/archive_openssl_hmac_private.h +++ b/libarchive/archive_openssl_hmac_private.h @@ -39,7 +39,7 @@ #include /* memset */ static inline HMAC_CTX *HMAC_CTX_new(void) { - HMAC_CTX *ctx = (HMAC_CTX *)calloc(1, sizeof(HMAC_CTX)); + HMAC_CTX *ctx = calloc(1, sizeof(HMAC_CTX)); return ctx; } diff --git a/libarchive/archive_ppmd7.c b/libarchive/archive_ppmd7.c index cc3f778203f9..30124f1743e5 100644 --- a/libarchive/archive_ppmd7.c +++ b/libarchive/archive_ppmd7.c @@ -138,7 +138,7 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size) #else 4 - (size & 3); #endif - if ((p->Base = (Byte *)malloc(p->AlignOffset + size + if ((p->Base = malloc(p->AlignOffset + size #ifndef PPMD_32BIT + UNIT_SIZE #endif diff --git a/libarchive/archive_ppmd8.c b/libarchive/archive_ppmd8.c index bae597095711..2fb7f7141c36 100644 --- a/libarchive/archive_ppmd8.c +++ b/libarchive/archive_ppmd8.c @@ -107,7 +107,7 @@ Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size) #else 4 - (size & 3); #endif - if ((p->Base = (Byte *)malloc(p->AlignOffset + size)) == 0) + if ((p->Base = malloc(p->AlignOffset + size)) == 0) return False; p->Size = size; } diff --git a/libarchive/archive_private.h b/libarchive/archive_private.h index 5c5b5607aea2..050fc63c0b2e 100644 --- a/libarchive/archive_private.h +++ b/libarchive/archive_private.h @@ -160,9 +160,9 @@ __LA_NORETURN void __archive_errx(int retvalue, const char *msg); void __archive_ensure_cloexec_flag(int fd); int __archive_mktemp(const char *tmpdir); #if defined(_WIN32) && !defined(__CYGWIN__) -int __archive_mkstemp(wchar_t *template); +int __archive_mkstemp(wchar_t *templates); #else -int __archive_mkstemp(char *template); +int __archive_mkstemp(char *templates); #endif int __archive_clean(struct archive *); diff --git a/libarchive/archive_read.c b/libarchive/archive_read.c index 1fa35853c558..822c534b868a 100644 --- a/libarchive/archive_read.c +++ b/libarchive/archive_read.c @@ -92,7 +92,7 @@ archive_read_new(void) { struct archive_read *a; - a = (struct archive_read *)calloc(1, sizeof(*a)); + a = calloc(1, sizeof(*a)); if (a == NULL) return (NULL); a->archive.magic = ARCHIVE_READ_MAGIC; @@ -582,7 +582,7 @@ choose_filters(struct archive_read *a) } filter - = (struct archive_read_filter *)calloc(1, sizeof(*filter)); + = calloc(1, sizeof(*filter)); if (filter == NULL) return (ARCHIVE_FATAL); filter->bidder = best_bidder; @@ -1451,7 +1451,7 @@ __archive_read_filter_ahead(struct archive_read_filter *filter, s = t; } /* Now s >= min, so allocate a new buffer. */ - p = (char *)malloc(s); + p = malloc(s); if (p == NULL) { archive_set_error( &filter->archive->archive, diff --git a/libarchive/archive_read_append_filter.c b/libarchive/archive_read_append_filter.c index 59ea5c4422dc..a3986e9b6e88 100644 --- a/libarchive/archive_read_append_filter.c +++ b/libarchive/archive_read_append_filter.c @@ -123,8 +123,7 @@ archive_read_append_filter(struct archive *_a, int code) return (ARCHIVE_FATAL); } - filter - = (struct archive_read_filter *)calloc(1, sizeof(*filter)); + filter = calloc(1, sizeof(*filter)); if (filter == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); @@ -180,8 +179,7 @@ archive_read_append_filter_program_signature(struct archive *_a, return (ARCHIVE_FATAL); } - filter - = (struct archive_read_filter *)calloc(1, sizeof(*filter)); + filter = calloc(1, sizeof(*filter)); if (filter == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 76a4fa44de72..09965eb98a2e 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -451,7 +451,7 @@ archive_read_disk_new(void) { struct archive_read_disk *a; - a = (struct archive_read_disk *)calloc(1, sizeof(*a)); + a = calloc(1, sizeof(*a)); if (a == NULL) return (NULL); a->archive.magic = ARCHIVE_READ_DISK_MAGIC; diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c index 285747ea91e0..cb59b516069a 100644 --- a/libarchive/archive_read_disk_windows.c +++ b/libarchive/archive_read_disk_windows.c @@ -49,6 +49,8 @@ /* Old SDKs do not provide IO_REPARSE_TAG_SYMLINK */ #define IO_REPARSE_TAG_SYMLINK 0xA000000CL #endif +/* To deal with absolute symlink isuues */ +#define START_ABSOLUTE_SYMLINK_REPARSE L"\\??\\" /*- * This is a new directory-walking system that addresses a number @@ -375,7 +377,7 @@ la_linkname_from_handle(HANDLE h, wchar_t **linkname, int *linktype) return (-1); } - tbuf = malloc(len + 1 * sizeof(wchar_t)); + tbuf = malloc(len + sizeof(wchar_t)); if (tbuf == NULL) { free(indata); return (-1); @@ -386,18 +388,21 @@ la_linkname_from_handle(HANDLE h, wchar_t **linkname, int *linktype) free(indata); tbuf[len / sizeof(wchar_t)] = L'\0'; + if (wcsncmp(tbuf, START_ABSOLUTE_SYMLINK_REPARSE, 4) == 0) { + /* Absolute symlink, so we'll change the NT path into a verbatim one */ + tbuf[1] = L'\\'; + } else { + /* Relative symlink, so we can translate backslashes to slashes */ + wchar_t *temp = tbuf; + do { + if (*temp == L'\\') + *temp = L'/'; + temp++; + } while(*temp != L'\0'); + } *linkname = tbuf; - /* - * Translate backslashes to slashes for libarchive internal use - */ - while(*tbuf != L'\0') { - if (*tbuf == L'\\') - *tbuf = L'/'; - tbuf++; - } - if ((st.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) *linktype = AE_SYMLINK_TYPE_FILE; else @@ -538,7 +543,7 @@ archive_read_disk_new(void) { struct archive_read_disk *a; - a = (struct archive_read_disk *)calloc(1, sizeof(*a)); + a = calloc(1, sizeof(*a)); if (a == NULL) return (NULL); a->archive.magic = ARCHIVE_READ_DISK_MAGIC; @@ -2473,7 +2478,7 @@ setup_sparse_from_disk(struct archive_read_disk *a, range.FileOffset.QuadPart = 0; range.Length.QuadPart = entry_size; outranges_size = 2048; - outranges = (FILE_ALLOCATED_RANGE_BUFFER *)malloc(outranges_size); + outranges = malloc(outranges_size); if (outranges == NULL) { archive_set_error(&a->archive, ENOMEM, "Couldn't allocate memory"); diff --git a/libarchive/archive_read_extract2.c b/libarchive/archive_read_extract2.c index e11cac1590e9..7cf38c301176 100644 --- a/libarchive/archive_read_extract2.c +++ b/libarchive/archive_read_extract2.c @@ -51,7 +51,7 @@ struct archive_read_extract * __archive_read_get_extract(struct archive_read *a) { if (a->extract == NULL) { - a->extract = (struct archive_read_extract *)calloc(1, sizeof(*a->extract)); + a->extract = calloc(1, sizeof(*a->extract)); if (a->extract == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't extract"); return (NULL); diff --git a/libarchive/archive_read_open_fd.c b/libarchive/archive_read_open_fd.c index 3ee2423d300e..debfde208687 100644 --- a/libarchive/archive_read_open_fd.c +++ b/libarchive/archive_read_open_fd.c @@ -74,7 +74,7 @@ archive_read_open_fd(struct archive *a, int fd, size_t block_size) return (ARCHIVE_FATAL); } - mine = (struct read_fd_data *)calloc(1, sizeof(*mine)); + mine = calloc(1, sizeof(*mine)); b = malloc(block_size); if (mine == NULL || b == NULL) { archive_set_error(a, ENOMEM, "No memory"); diff --git a/libarchive/archive_read_open_file.c b/libarchive/archive_read_open_file.c index dcf1d4698569..cf49ebd8fc9a 100644 --- a/libarchive/archive_read_open_file.c +++ b/libarchive/archive_read_open_file.c @@ -69,7 +69,7 @@ archive_read_open_FILE(struct archive *a, FILE *f) void *b; archive_clear_error(a); - mine = (struct read_FILE_data *)malloc(sizeof(*mine)); + mine = malloc(sizeof(*mine)); b = malloc(block_size); if (mine == NULL || b == NULL) { archive_set_error(a, ENOMEM, "No memory"); diff --git a/libarchive/archive_read_open_filename.c b/libarchive/archive_read_open_filename.c index dd2e16022844..8def020fff38 100644 --- a/libarchive/archive_read_open_filename.c +++ b/libarchive/archive_read_open_filename.c @@ -122,7 +122,7 @@ archive_read_open_filenames(struct archive *a, const char **filenames, { if (filename == NULL) filename = ""; - mine = (struct read_file_data *)calloc(1, + mine = calloc(1, sizeof(*mine) + strlen(filename)); if (mine == NULL) goto no_memory; @@ -175,7 +175,7 @@ archive_read_open_filenames_w(struct archive *a, const wchar_t **wfilenames, { if (wfilename == NULL) wfilename = L""; - mine = (struct read_file_data *)calloc(1, + mine = calloc(1, sizeof(*mine) + wcslen(wfilename) * sizeof(wchar_t)); if (mine == NULL) goto no_memory; diff --git a/libarchive/archive_read_open_memory.c b/libarchive/archive_read_open_memory.c index a057ce643890..460bb5ae6a4d 100644 --- a/libarchive/archive_read_open_memory.c +++ b/libarchive/archive_read_open_memory.c @@ -69,7 +69,7 @@ archive_read_open_memory2(struct archive *a, const void *buff, { struct read_memory_data *mine; - mine = (struct read_memory_data *)calloc(1, sizeof(*mine)); + mine = calloc(1, sizeof(*mine)); if (mine == NULL) { archive_set_error(a, ENOMEM, "No memory"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_read_support_filter_bzip2.c b/libarchive/archive_read_support_filter_bzip2.c index 0392d450a203..479237c27792 100644 --- a/libarchive/archive_read_support_filter_bzip2.c +++ b/libarchive/archive_read_support_filter_bzip2.c @@ -190,8 +190,8 @@ bzip2_reader_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_BZIP2; self->name = "bzip2"; - state = (struct private_data *)calloc(1, sizeof(*state)); - out_block = (unsigned char *)malloc(out_block_size); + state = calloc(1, sizeof(*state)); + out_block = malloc(out_block_size); if (state == NULL || out_block == NULL) { archive_set_error(&self->archive->archive, ENOMEM, "Can't allocate data for bzip2 decompression"); diff --git a/libarchive/archive_read_support_filter_compress.c b/libarchive/archive_read_support_filter_compress.c index 29ae72abef71..b6e9816dfee9 100644 --- a/libarchive/archive_read_support_filter_compress.c +++ b/libarchive/archive_read_support_filter_compress.c @@ -217,7 +217,7 @@ compress_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_COMPRESS; self->name = "compress (.Z)"; - state = (struct private_data *)calloc(1, sizeof(*state)); + state = calloc(1, sizeof(*state)); out_block = malloc(out_block_size); if (state == NULL || out_block == NULL) { free(out_block); diff --git a/libarchive/archive_read_support_filter_gzip.c b/libarchive/archive_read_support_filter_gzip.c index 152ea9bdbd7c..726385e328a0 100644 --- a/libarchive/archive_read_support_filter_gzip.c +++ b/libarchive/archive_read_support_filter_gzip.c @@ -123,6 +123,8 @@ archive_read_support_filter_gzip(struct archive *_a) * number of bytes in header. If pbits is non-NULL, it receives a * count of bits verified, suitable for use by bidder. */ +#define MAX_FILENAME_LENGTH (1024 * 1024L) +#define MAX_COMMENT_LENGTH (1024 * 1024L) static ssize_t peek_at_header(struct archive_read_filter *filter, int *pbits, #ifdef HAVE_ZLIB_H @@ -180,9 +182,13 @@ peek_at_header(struct archive_read_filter *filter, int *pbits, #endif do { ++len; - if (avail < len) + if (avail < len) { + if (avail > MAX_FILENAME_LENGTH) { + return (0); + } p = __archive_read_filter_ahead(filter, len, &avail); + } if (p == NULL) return (0); } while (p[len - 1] != 0); @@ -200,9 +206,13 @@ peek_at_header(struct archive_read_filter *filter, int *pbits, if (header_flags & 16) { do { ++len; - if (avail < len) + if (avail < len) { + if (avail > MAX_COMMENT_LENGTH) { + return (0); + } p = __archive_read_filter_ahead(filter, len, &avail); + } if (p == NULL) return (0); } while (p[len - 1] != 0); @@ -307,8 +317,8 @@ gzip_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_GZIP; self->name = "gzip"; - state = (struct private_data *)calloc(1, sizeof(*state)); - out_block = (unsigned char *)malloc(out_block_size); + state = calloc(1, sizeof(*state)); + out_block = malloc(out_block_size); if (state == NULL || out_block == NULL) { free(out_block); free(state); diff --git a/libarchive/archive_read_support_filter_lz4.c b/libarchive/archive_read_support_filter_lz4.c index bccf4fb8f82d..8c9777156409 100644 --- a/libarchive/archive_read_support_filter_lz4.c +++ b/libarchive/archive_read_support_filter_lz4.c @@ -223,7 +223,7 @@ lz4_reader_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_LZ4; self->name = "lz4"; - state = (struct private_data *)calloc(1, sizeof(*state)); + state = calloc(1, sizeof(*state)); if (state == NULL) { archive_set_error(&self->archive->archive, ENOMEM, "Can't allocate data for lz4 decompression"); @@ -248,7 +248,7 @@ lz4_allocate_out_block(struct archive_read_filter *self) out_block_size += 64 * 1024; if (state->out_block_size < out_block_size) { free(state->out_block); - out_block = (unsigned char *)malloc(out_block_size); + out_block = malloc(out_block_size); state->out_block_size = out_block_size; if (out_block == NULL) { archive_set_error(&self->archive->archive, ENOMEM, @@ -271,7 +271,7 @@ lz4_allocate_out_block_for_legacy(struct archive_read_filter *self) if (state->out_block_size < out_block_size) { free(state->out_block); - out_block = (unsigned char *)malloc(out_block_size); + out_block = malloc(out_block_size); state->out_block_size = out_block_size; if (out_block == NULL) { archive_set_error(&self->archive->archive, ENOMEM, diff --git a/libarchive/archive_read_support_filter_lzop.c b/libarchive/archive_read_support_filter_lzop.c index 0aa85927b4a0..b0c4bb13e8b3 100644 --- a/libarchive/archive_read_support_filter_lzop.c +++ b/libarchive/archive_read_support_filter_lzop.c @@ -185,7 +185,7 @@ lzop_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_LZOP; self->name = "lzop"; - state = (struct read_lzop *)calloc(1, sizeof(*state)); + state = calloc(1, sizeof(*state)); if (state == NULL) { archive_set_error(&self->archive->archive, ENOMEM, "Can't allocate data for lzop decompression"); diff --git a/libarchive/archive_read_support_filter_program.c b/libarchive/archive_read_support_filter_program.c index 0482c57c18eb..9e825223b26c 100644 --- a/libarchive/archive_read_support_filter_program.c +++ b/libarchive/archive_read_support_filter_program.c @@ -139,7 +139,7 @@ archive_read_support_filter_program_signature(struct archive *_a, /* * Allocate our private state. */ - state = (struct program_bidder *)calloc(1, sizeof (*state)); + state = calloc(1, sizeof (*state)); if (state == NULL) goto memerr; state->cmd = strdup(cmd); @@ -398,8 +398,8 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd) size_t l; l = strlen(prefix) + strlen(cmd) + 1; - state = (struct program_filter *)calloc(1, sizeof(*state)); - out_buf = (char *)malloc(out_buf_len); + state = calloc(1, sizeof(*state)); + out_buf = malloc(out_buf_len); if (state == NULL || out_buf == NULL || archive_string_ensure(&state->description, l) == NULL) { archive_set_error(&self->archive->archive, ENOMEM, diff --git a/libarchive/archive_read_support_filter_rpm.c b/libarchive/archive_read_support_filter_rpm.c index a55bc0cf71e9..25ace4a25bc9 100644 --- a/libarchive/archive_read_support_filter_rpm.c +++ b/libarchive/archive_read_support_filter_rpm.c @@ -144,7 +144,7 @@ rpm_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_RPM; self->name = "rpm"; - rpm = (struct rpm *)calloc(1, sizeof(*rpm)); + rpm = calloc(1, sizeof(*rpm)); if (rpm == NULL) { archive_set_error(&self->archive->archive, ENOMEM, "Can't allocate data for rpm"); diff --git a/libarchive/archive_read_support_filter_uu.c b/libarchive/archive_read_support_filter_uu.c index 8d361a4f8e76..d722fe343657 100644 --- a/libarchive/archive_read_support_filter_uu.c +++ b/libarchive/archive_read_support_filter_uu.c @@ -375,7 +375,7 @@ uudecode_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_UU; self->name = "uu"; - uudecode = (struct uudecode *)calloc(1, sizeof(*uudecode)); + uudecode = calloc(1, sizeof(*uudecode)); out_buff = malloc(OUT_BUFF_SIZE); in_buff = malloc(IN_BUFF_SIZE); if (uudecode == NULL || out_buff == NULL || in_buff == NULL) { diff --git a/libarchive/archive_read_support_filter_xz.c b/libarchive/archive_read_support_filter_xz.c index e55fb00edb34..dcbf734ecacb 100644 --- a/libarchive/archive_read_support_filter_xz.c +++ b/libarchive/archive_read_support_filter_xz.c @@ -476,8 +476,8 @@ xz_lzma_bidder_init(struct archive_read_filter *self) struct private_data *state; int ret; - state = (struct private_data *)calloc(1, sizeof(*state)); - out_block = (unsigned char *)malloc(out_block_size); + state = calloc(1, sizeof(*state)); + out_block = malloc(out_block_size); if (state == NULL || out_block == NULL) { archive_set_error(&self->archive->archive, ENOMEM, "Can't allocate data for xz decompression"); diff --git a/libarchive/archive_read_support_filter_zstd.c b/libarchive/archive_read_support_filter_zstd.c index f7326d2430d3..9a1dd71abdf6 100644 --- a/libarchive/archive_read_support_filter_zstd.c +++ b/libarchive/archive_read_support_filter_zstd.c @@ -175,8 +175,8 @@ zstd_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_ZSTD; self->name = "zstd"; - state = (struct private_data *)calloc(1, sizeof(*state)); - out_block = (unsigned char *)malloc(out_block_size); + state = calloc(1, sizeof(*state)); + out_block = malloc(out_block_size); dstream = ZSTD_createDStream(); if (state == NULL || out_block == NULL || dstream == NULL) { diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c index b1e0c91ad1a9..b4e34d68dbba 100644 --- a/libarchive/archive_read_support_format_7zip.c +++ b/libarchive/archive_read_support_format_7zip.c @@ -767,29 +767,27 @@ archive_read_format_7zip_read_header(struct archive_read *a, if (zip_entry->attr & supported_attrs) { char *fflags_text, *ptr; - /* allocate for "rdonly,hidden,system," */ - fflags_text = malloc(22 * sizeof(char)); + /* allocate for ",rdonly,hidden,system" */ + fflags_text = malloc(22 * sizeof(*fflags_text)); if (fflags_text != NULL) { ptr = fflags_text; - if (zip_entry->attr & FILE_ATTRIBUTE_READONLY) { - strcpy(ptr, "rdonly,"); - ptr = ptr + 7; - } - if (zip_entry->attr & FILE_ATTRIBUTE_HIDDEN) { - strcpy(ptr, "hidden,"); - ptr = ptr + 7; - } - if (zip_entry->attr & FILE_ATTRIBUTE_SYSTEM) { - strcpy(ptr, "system,"); - ptr = ptr + 7; - } - if (ptr > fflags_text) { - /* Delete trailing comma */ - *(ptr - 1) = '\0'; - archive_entry_copy_fflags_text(entry, - fflags_text); - } - free(fflags_text); + if (zip_entry->attr & FILE_ATTRIBUTE_READONLY) { + strcpy(ptr, ",rdonly"); + ptr = ptr + 7; + } + if (zip_entry->attr & FILE_ATTRIBUTE_HIDDEN) { + strcpy(ptr, ",hidden"); + ptr = ptr + 7; + } + if (zip_entry->attr & FILE_ATTRIBUTE_SYSTEM) { + strcpy(ptr, ",system"); + ptr = ptr + 7; + } + if (ptr > fflags_text) { + archive_entry_copy_fflags_text(entry, + fflags_text + 1); + } + free(fflags_text); } } @@ -835,9 +833,20 @@ archive_read_format_7zip_read_header(struct archive_read *a, zip_entry->mode |= AE_IFREG; archive_entry_set_mode(entry, zip_entry->mode); } else { + struct archive_string_conv* utf8_conv; + symname[symsize] = '\0'; - archive_entry_copy_symlink(entry, - (const char *)symname); + + /* Symbolic links are embedded as UTF-8 strings */ + utf8_conv = archive_string_conversion_from_charset(&a->archive, + "UTF-8", 1); + if (utf8_conv == NULL) { + free(symname); + return ARCHIVE_FATAL; + } + + archive_entry_copy_symlink_l(entry, (const char*)symname, symsize, + utf8_conv); } free(symname); archive_entry_set_size(entry, 0); diff --git a/libarchive/archive_read_support_format_ar.c b/libarchive/archive_read_support_format_ar.c index b0d1ddbc5a0a..6dfe2939d090 100644 --- a/libarchive/archive_read_support_format_ar.c +++ b/libarchive/archive_read_support_format_ar.c @@ -103,7 +103,7 @@ archive_read_support_format_ar(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_ar"); - ar = (struct ar *)calloc(1, sizeof(*ar)); + ar = calloc(1, sizeof(*ar)); if (ar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate ar data"); @@ -368,7 +368,7 @@ _ar_read_header(struct archive_read *a, struct archive_entry *entry, return (ARCHIVE_FATAL); } /* Store it in the entry. */ - p = (char *)malloc(bsd_name_length + 1); + p = malloc(bsd_name_length + 1); if (p == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate fname buffer"); diff --git a/libarchive/archive_read_support_format_cab.c b/libarchive/archive_read_support_format_cab.c index 4ed088d43c4d..e012248a5bc2 100644 --- a/libarchive/archive_read_support_format_cab.c +++ b/libarchive/archive_read_support_format_cab.c @@ -356,7 +356,7 @@ archive_read_support_format_cab(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_cab"); - cab = (struct cab *)calloc(1, sizeof(*cab)); + cab = calloc(1, sizeof(*cab)); if (cab == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate CAB data"); @@ -717,7 +717,7 @@ cab_read_header(struct archive_read *a) /* * Read CFFOLDER. */ - hd->folder_array = (struct cffolder *)calloc( + hd->folder_array = calloc( hd->folder_count, sizeof(struct cffolder)); if (hd->folder_array == NULL) goto nomem; @@ -780,7 +780,7 @@ cab_read_header(struct archive_read *a) cab->cab_offset += skip; } /* Allocate memory for CFDATA */ - hd->file_array = (struct cffile *)calloc( + hd->file_array = calloc( hd->file_count, sizeof(struct cffile)); if (hd->file_array == NULL) goto nomem; @@ -1412,7 +1412,7 @@ cab_read_ahead_cfdata_deflate(struct archive_read *a, ssize_t *avail) if (cab->uncompressed_buffer == NULL) { cab->uncompressed_buffer_size = 0x8000; cab->uncompressed_buffer - = (unsigned char *)malloc(cab->uncompressed_buffer_size); + = malloc(cab->uncompressed_buffer_size); if (cab->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory for CAB reader"); @@ -1641,7 +1641,7 @@ cab_read_ahead_cfdata_lzx(struct archive_read *a, ssize_t *avail) if (cab->uncompressed_buffer == NULL) { cab->uncompressed_buffer_size = 0x8000; cab->uncompressed_buffer - = (unsigned char *)malloc(cab->uncompressed_buffer_size); + = malloc(cab->uncompressed_buffer_size); if (cab->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory for CAB reader"); diff --git a/libarchive/archive_read_support_format_cpio.c b/libarchive/archive_read_support_format_cpio.c index 69752cbb0cac..42a89c1b69c4 100644 --- a/libarchive/archive_read_support_format_cpio.c +++ b/libarchive/archive_read_support_format_cpio.c @@ -228,7 +228,7 @@ archive_read_support_format_cpio(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_cpio"); - cpio = (struct cpio *)calloc(1, sizeof(*cpio)); + cpio = calloc(1, sizeof(*cpio)); if (cpio == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data"); return (ARCHIVE_FATAL); @@ -1088,7 +1088,7 @@ record_hardlink(struct archive_read *a, } } - le = (struct links_entry *)malloc(sizeof(struct links_entry)); + le = malloc(sizeof(struct links_entry)); if (le == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory adding file to list"); diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index 951afb6037e5..baf265f46229 100644 --- a/libarchive/archive_read_support_format_iso9660.c +++ b/libarchive/archive_read_support_format_iso9660.c @@ -463,7 +463,7 @@ archive_read_support_format_iso9660(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_iso9660"); - iso9660 = (struct iso9660 *)calloc(1, sizeof(*iso9660)); + iso9660 = calloc(1, sizeof(*iso9660)); if (iso9660 == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate iso9660 data"); @@ -1905,7 +1905,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent, } /* Create a new file entry and copy data from the ISO dir record. */ - file = (struct file_info *)calloc(1, sizeof(*file)); + file = calloc(1, sizeof(*file)); if (file == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory for file entry"); diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c index e417baad10a6..c7cbad272ead 100644 --- a/libarchive/archive_read_support_format_lha.c +++ b/libarchive/archive_read_support_format_lha.c @@ -265,7 +265,7 @@ archive_read_support_format_lha(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_lha"); - lha = (struct lha *)calloc(1, sizeof(*lha)); + lha = calloc(1, sizeof(*lha)); if (lha == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate lha data"); diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c index 6971228eefad..ba0e49de2408 100644 --- a/libarchive/archive_read_support_format_mtree.c +++ b/libarchive/archive_read_support_format_mtree.c @@ -273,7 +273,7 @@ archive_read_support_format_mtree(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_mtree"); - mtree = (struct mtree *)calloc(1, sizeof(*mtree)); + mtree = calloc(1, sizeof(*mtree)); if (mtree == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate mtree data"); diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c index cbc6ec984068..9cf4d639a79d 100644 --- a/libarchive/archive_read_support_format_rar.c +++ b/libarchive/archive_read_support_format_rar.c @@ -734,7 +734,7 @@ archive_read_support_format_rar(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_rar"); - rar = (struct rar *)calloc(1, sizeof(*rar)); + rar = calloc(1, sizeof(*rar)); if (rar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate rar data"); @@ -1371,7 +1371,7 @@ read_header(struct archive_read *a, struct archive_entry *entry, char unp_size[8]; int ttime; struct archive_string_conv *sconv, *fn_sconv; - unsigned long crc32_val; + uint32_t crc32_computed, crc32_read; int ret = (ARCHIVE_OK), ret2; char *newptr; size_t newsize; @@ -1402,7 +1402,7 @@ read_header(struct archive_read *a, struct archive_entry *entry, "Invalid header size"); return (ARCHIVE_FATAL); } - crc32_val = crc32(0, (const unsigned char *)p + 2, 7 - 2); + crc32_computed = crc32(0, (const unsigned char *)p + 2, 7 - 2); __archive_read_consume(a, 7); if (!(rar->file_flags & FHD_SOLID)) @@ -1436,8 +1436,9 @@ read_header(struct archive_read *a, struct archive_entry *entry, return (ARCHIVE_FATAL); /* File Header CRC check. */ - crc32_val = crc32(crc32_val, h, (unsigned)(header_size - 7)); - if ((crc32_val & 0xffff) != archive_le16dec(rar_header.crc)) { + crc32_computed = crc32(crc32_computed, h, (unsigned)(header_size - 7)); + crc32_read = archive_le16dec(rar_header.crc); + if ((crc32_computed & 0xffff) != crc32_read) { #ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Header CRC error"); @@ -2802,9 +2803,7 @@ make_table(struct archive_read *a, struct huffman_code *code) else code->tablesize = code->maxlength; - code->table = - (struct huffman_table_entry *)calloc(1, sizeof(*code->table) - * ((size_t)1 << code->tablesize)); + code->table = calloc(1U << code->tablesize, sizeof(*code->table)); return make_table_recurse(a, code, 0, code->table, 0, code->tablesize); } diff --git a/libarchive/archive_read_support_format_rar5.c b/libarchive/archive_read_support_format_rar5.c index d23ef31844be..b99105d0cd33 100644 --- a/libarchive/archive_read_support_format_rar5.c +++ b/libarchive/archive_read_support_format_rar5.c @@ -210,7 +210,11 @@ struct comp_state { or just a part of it. */ uint8_t block_parsing_finished : 1; - signed int notused : 4; + /* Flag used to indicate that a previous file using this buffer was + encrypted, meaning no data in the buffer can be trusted */ + uint8_t data_encrypted : 1; + + signed int notused : 3; int flags; /* Uncompression flags. */ int method; /* Uncompression algorithm method. */ @@ -352,6 +356,12 @@ struct rar5 { /* The header of currently processed RARv5 block. Used in main * decompression logic loop. */ struct compressed_block_header last_block_hdr; + + /* + * Custom field to denote that this archive contains encrypted entries + */ + int has_encrypted_entries; + int headers_are_encrypted; }; /* Forward function declarations. */ @@ -535,8 +545,7 @@ static void write_filter_data(struct rar5* rar, uint32_t offset, /* Allocates a new filter descriptor and adds it to the filter array. */ static struct filter_info* add_new_filter(struct rar5* rar) { - struct filter_info* f = - (struct filter_info*) calloc(1, sizeof(struct filter_info)); + struct filter_info* f = calloc(1, sizeof(*f)); if(!f) { return NULL; @@ -1597,6 +1606,7 @@ static int process_head_file_extra(struct archive_read* a, if(!read_var(a, &extra_field_id, &var_size)) return ARCHIVE_EOF; + extra_field_size -= var_size; extra_data_size -= var_size; if(ARCHIVE_OK != consume(a, var_size)) { return ARCHIVE_EOF; @@ -1624,12 +1634,19 @@ static int process_head_file_extra(struct archive_read* a, &extra_data_size); break; case EX_CRYPT: + /* Mark the entry as encrypted */ + archive_entry_set_is_data_encrypted(e, 1); + rar->has_encrypted_entries = 1; + rar->cstate.data_encrypted = 1; /* fallthrough */ case EX_SUBDATA: /* fallthrough */ default: /* Skip unsupported entry. */ - return consume(a, extra_data_size); + extra_data_size -= extra_field_size; + if (ARCHIVE_OK != consume(a, extra_field_size)) { + return ARCHIVE_EOF; + } } } @@ -1747,9 +1764,11 @@ static int process_head_file(struct archive_read* a, struct rar5* rar, rar->file.solid = (compression_info & SOLID) > 0; /* Archives which declare solid files without initializing the window - * buffer first are invalid. */ + * buffer first are invalid, unless previous data was encrypted, in + * which case we may never have had the chance */ - if(rar->file.solid > 0 && rar->cstate.window_buf == NULL) { + if(rar->file.solid > 0 && rar->cstate.data_encrypted == 0 && + rar->cstate.window_buf == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Declared solid file, but no window buffer " "initialized yet."); @@ -1778,6 +1797,8 @@ static int process_head_file(struct archive_read* a, struct rar5* rar, return ARCHIVE_FATAL; } } + else + rar->cstate.data_encrypted = 0; /* Reset for new buffer */ if(rar->cstate.window_size < (ssize_t) window_size && rar->cstate.window_buf) @@ -1846,27 +1867,25 @@ static int process_head_file(struct archive_read* a, struct rar5* rar, if (file_attr & (ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM)) { char *fflags_text, *ptr; - /* allocate for "rdonly,hidden,system," */ - fflags_text = malloc(22 * sizeof(char)); + /* allocate for ",rdonly,hidden,system" */ + fflags_text = malloc(22 * sizeof(*fflags_text)); if (fflags_text != NULL) { ptr = fflags_text; if (file_attr & ATTR_READONLY) { - strcpy(ptr, "rdonly,"); + strcpy(ptr, ",rdonly"); ptr = ptr + 7; } if (file_attr & ATTR_HIDDEN) { - strcpy(ptr, "hidden,"); + strcpy(ptr, ",hidden"); ptr = ptr + 7; } if (file_attr & ATTR_SYSTEM) { - strcpy(ptr, "system,"); + strcpy(ptr, ",system"); ptr = ptr + 7; } if (ptr > fflags_text) { - /* Delete trailing comma */ - *(ptr - 1) = '\0'; archive_entry_copy_fflags_text(entry, - fflags_text); + fflags_text + 1); } free(fflags_text); } @@ -2282,6 +2301,10 @@ static int process_base_block(struct archive_read* a, ret = process_head_file(a, rar, entry, header_flags); return ret; case HEAD_CRYPT: + archive_entry_set_is_metadata_encrypted(entry, 1); + archive_entry_set_is_data_encrypted(entry, 1); + rar->has_encrypted_entries = 1; + rar->headers_are_encrypted = 1; archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Encryption is not supported"); @@ -2426,6 +2449,14 @@ static int rar5_read_header(struct archive_read *a, struct rar5* rar = get_context(a); int ret; + /* + * It should be sufficient to call archive_read_next_header() for + * a reader to determine if an entry is encrypted or not. + */ + if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + rar->has_encrypted_entries = 0; + } + if(rar->header_initialized == 0) { init_header(a); if ((ret = try_skip_sfx(a)) < ARCHIVE_WARN) @@ -4086,6 +4117,16 @@ static int rar5_read_data(struct archive_read *a, const void **buff, if (size) *size = 0; + if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + rar->has_encrypted_entries = 0; + } + + if (rar->headers_are_encrypted || rar->cstate.data_encrypted) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Reading encrypted data is not currently supported"); + return ARCHIVE_FATAL; + } + if(rar->file.dir > 0) { /* Don't process any data if this file entry was declared * as a directory. This is needed, because entries marked as @@ -4137,11 +4178,14 @@ static int rar5_read_data(struct archive_read *a, const void **buff, static int rar5_read_data_skip(struct archive_read *a) { struct rar5* rar = get_context(a); - if(rar->main.solid) { + if(rar->main.solid && (rar->cstate.data_encrypted == 0)) { /* In solid archives, instead of skipping the data, we need to * extract it, and dispose the result. The side effect of this * operation will be setting up the initial window buffer state - * needed to be able to extract the selected file. */ + * needed to be able to extract the selected file. Note that + * this is only possible when data withing this solid block is + * not encrypted, in which case we'll skip and fail if the user + * tries to read data. */ int ret; @@ -4217,14 +4261,19 @@ static int rar5_cleanup(struct archive_read *a) { static int rar5_capabilities(struct archive_read * a) { (void) a; - return 0; + return (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA + | ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA); } static int rar5_has_encrypted_entries(struct archive_read *_a) { - (void) _a; + if (_a && _a->format) { + struct rar5 *rar = (struct rar5 *)_a->format->data; + if (rar) { + return rar->has_encrypted_entries; + } + } - /* Unsupported for now. */ - return ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED; + return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; } static int rar5_init(struct rar5* rar) { @@ -4233,6 +4282,12 @@ static int rar5_init(struct rar5* rar) { if(CDE_OK != cdeque_init(&rar->cstate.filters, 8192)) return ARCHIVE_FATAL; + /* + * Until enough data has been read, we cannot tell about + * any encrypted entries yet. + */ + rar->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; + return ARCHIVE_OK; } diff --git a/libarchive/archive_read_support_format_raw.c b/libarchive/archive_read_support_format_raw.c index efdbf276baf7..e935396dda6f 100644 --- a/libarchive/archive_read_support_format_raw.c +++ b/libarchive/archive_read_support_format_raw.c @@ -61,7 +61,7 @@ archive_read_support_format_raw(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_raw"); - info = (struct raw_info *)calloc(1, sizeof(*info)); + info = calloc(1, sizeof(*info)); if (info == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate raw_info data"); diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index ab0b20a7e140..ecaf6c392d9a 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -123,8 +123,6 @@ struct tar { struct archive_string entry_uname; struct archive_string entry_gname; struct archive_string entry_linkpath; - struct archive_string longname; - struct archive_string pax_global; struct archive_string line; int pax_hdrcharset_utf8; int64_t entry_bytes_remaining; @@ -258,7 +256,7 @@ archive_read_support_format_tar(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_tar"); - tar = (struct tar *)calloc(1, sizeof(*tar)); + tar = calloc(1, sizeof(*tar)); if (tar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate tar data"); @@ -298,8 +296,6 @@ archive_read_format_tar_cleanup(struct archive_read *a) archive_string_free(&tar->entry_gname); archive_string_free(&tar->entry_linkpath); archive_string_free(&tar->line); - archive_string_free(&tar->pax_global); - archive_string_free(&tar->longname); archive_string_free(&tar->localname); free(tar); (a->format->data) = NULL; @@ -631,8 +627,6 @@ archive_read_format_tar_read_data(struct archive_read *a, } *buff = __archive_read_ahead(a, 1, &bytes_read); - if (bytes_read < 0) - return (ARCHIVE_FATAL); if (*buff == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Truncated tar archive" @@ -750,8 +744,6 @@ tar_read_header(struct archive_read *a, struct tar *tar, /* Read 512-byte header record */ h = __archive_read_ahead(a, 512, &bytes); - if (bytes < 0) - return ((int)bytes); if (bytes == 0) { /* EOF at a block boundary. */ if (eof_fatal) { /* We've read a special header already; @@ -764,7 +756,7 @@ tar_read_header(struct archive_read *a, struct tar *tar, return (ARCHIVE_EOF); } } - if (bytes < 512) { /* Short block at EOF; this is bad. */ + if (h == NULL) { /* Short block at EOF; this is bad. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated tar archive" @@ -1013,7 +1005,12 @@ checksum(struct archive_read *a, const void *h) if (sum == check) return (1); +#if DONT_FAIL_ON_CRC_ERROR + /* Speed up fuzzing by pretending the checksum is always right. */ + return (1); +#else return (0); +#endif } /* @@ -1044,16 +1041,14 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar, int64_t type; char *acl, *p; - /* - * read_body_to_string adds a NUL terminator, but we need a little - * more to make sure that we don't overrun acl_text later. - */ header = (const struct archive_entry_header_ustar *)h; size = (size_t)tar_atol(header->size, sizeof(header->size)); archive_string_init(&acl_text); err = read_body_to_string(a, tar, &acl_text, h, unconsumed); - if (err != ARCHIVE_OK) + if (err != ARCHIVE_OK) { + archive_string_free(&acl_text); return (err); + } /* TODO: Examine the first characters to see if this * is an AIX ACL descriptor. We'll likely never support @@ -1178,13 +1173,16 @@ header_gnu_longname(struct archive_read *a, struct tar *tar, struct archive_entry *entry, const void *h, size_t *unconsumed) { int err; + struct archive_string longname; - err = read_body_to_string(a, tar, &(tar->longname), h, unconsumed); - if (err != ARCHIVE_OK) - return (err); - if (archive_entry_copy_pathname_l(entry, tar->longname.s, - archive_strlen(&(tar->longname)), tar->sconv) != 0) - err = set_conversion_failed_error(a, tar->sconv, "Pathname"); + archive_string_init(&longname); + err = read_body_to_string(a, tar, &longname, h, unconsumed); + if (err == ARCHIVE_OK) { + if (archive_entry_copy_pathname_l(entry, longname.s, + archive_strlen(&longname), tar->sconv) != 0) + err = set_conversion_failed_error(a, tar->sconv, "Pathname"); + } + archive_string_free(&longname); return (err); } @@ -1521,9 +1519,17 @@ header_old_tar(struct archive_read *a, struct tar *tar, const struct archive_entry_header_ustar *header; int err = ARCHIVE_OK, err2; - /* Copy filename over (to ensure null termination). */ + /* + * Copy filename over (to ensure null termination). + * Skip if pathname was already set e.g. by header_gnu_longname() + */ header = (const struct archive_entry_header_ustar *)h; - if (archive_entry_copy_pathname_l(entry, + + const char *existing_pathname = archive_entry_pathname(entry); + const wchar_t *existing_wcs_pathname = archive_entry_pathname_w(entry); + if ((existing_pathname == NULL || existing_pathname[0] == '\0') + && (existing_wcs_pathname == NULL || existing_wcs_pathname[0] == '\0') && + archive_entry_copy_pathname_l(entry, header->name, sizeof(header->name), tar->sconv) != 0) { err = set_conversion_failed_error(a, tar->sconv, "Pathname"); if (err == ARCHIVE_FATAL) @@ -1631,6 +1637,9 @@ read_mac_metadata_blob(struct archive_read *a, tar_flush_unconsumed(a, unconsumed); data = __archive_read_ahead(a, msize, NULL); if (data == NULL) { + archive_set_error(&a->archive, EINVAL, + "Truncated archive" + " detected while reading macOS metadata"); *unconsumed = 0; return (ARCHIVE_FATAL); } @@ -1818,10 +1827,7 @@ header_pax_extension(struct archive_read *a, struct tar *tar, to_read = ext_size; } p = __archive_read_ahead(a, to_read, &did_read); - if (did_read < 0) { - return ((int)did_read); - } - if (did_read == 0) { /* EOF */ + if (p == NULL) { /* EOF */ archive_set_error(&a->archive, EINVAL, "Truncated tar archive" " detected while reading pax attribute name"); @@ -1896,6 +1902,7 @@ header_pax_extension(struct archive_read *a, struct tar *tar, name_length = p - name_start; p++; // Skip '=' + // Save the name before we consume it archive_strncpy(&attr_name, name_start, name_length); ext_size -= p - attr_start; @@ -1909,6 +1916,9 @@ header_pax_extension(struct archive_read *a, struct tar *tar, r = pax_attribute(a, tar, entry, attr_name.s, archive_strlen(&attr_name), value_length - 1, unconsumed); ext_size -= value_length - 1; + // Release the allocated attr_name (either here or before every return in this function) + archive_string_free(&attr_name); + if (r < ARCHIVE_WARN) { *unconsumed += ext_size + ext_padding; return (r); @@ -1918,10 +1928,7 @@ header_pax_extension(struct archive_read *a, struct tar *tar, /* Consume the `\n` that follows the pax attribute value. */ tar_flush_unconsumed(a, unconsumed); p = __archive_read_ahead(a, 1, &did_read); - if (did_read < 0) { - return ((int)did_read); - } - if (did_read == 0) { + if (p == NULL) { archive_set_error(&a->archive, EINVAL, "Truncated tar archive" " detected while completing pax attribute"); @@ -1937,7 +1944,6 @@ header_pax_extension(struct archive_read *a, struct tar *tar, *unconsumed += 1; tar_flush_unconsumed(a, unconsumed); } - archive_string_free(&attr_name); *unconsumed += ext_size + ext_padding; /* @@ -2303,13 +2309,15 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent err = ARCHIVE_FAILED; } else { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p != NULL) { - if (gnu_sparse_01_parse(a, tar, p, value_length) != ARCHIVE_OK) { - err = ARCHIVE_WARN; - } - } else { + if (p == NULL) { + archive_set_error(&a->archive, EINVAL, + "Truncated archive" + " detected while reading GNU sparse data"); return (ARCHIVE_FATAL); } + if (gnu_sparse_01_parse(a, tar, p, value_length) != ARCHIVE_OK) { + err = ARCHIVE_WARN; + } } __archive_read_consume(a, value_length); return (err); @@ -2385,24 +2393,23 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent /* LIBARCHIVE.symlinktype */ if (value_length < 16) { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p != NULL) { - if (value_length == 4 && memcmp(p, "file", 4) == 0) { - archive_entry_set_symlink_type(entry, - AE_SYMLINK_TYPE_FILE); - } else if (value_length == 3 && memcmp(p, "dir", 3) == 0) { - archive_entry_set_symlink_type(entry, - AE_SYMLINK_TYPE_DIRECTORY); - } else { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Unrecognized symlink type"); - err = ARCHIVE_WARN; - } - } else { + if (p == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated tar archive " "detected while reading `symlinktype` attribute"); return (ARCHIVE_FATAL); } + if (value_length == 4 && memcmp(p, "file", 4) == 0) { + archive_entry_set_symlink_type(entry, + AE_SYMLINK_TYPE_FILE); + } else if (value_length == 3 && memcmp(p, "dir", 3) == 0) { + archive_entry_set_symlink_type(entry, + AE_SYMLINK_TYPE_DIRECTORY); + } else { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Unrecognized symlink type"); + err = ARCHIVE_WARN; + } } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "symlink type is very long" @@ -2420,8 +2427,13 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent err = ARCHIVE_WARN; } else { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p == NULL - || pax_attribute_LIBARCHIVE_xattr(entry, key, key_length, p, value_length)) { + if (p == NULL) { + archive_set_error(&a->archive, EINVAL, + "Truncated archive" + " detected while reading xattr information"); + return (ARCHIVE_FATAL); + } + if (pax_attribute_LIBARCHIVE_xattr(entry, key, key_length, p, value_length)) { /* TODO: Unable to parse xattr */ err = ARCHIVE_WARN; } @@ -2444,8 +2456,13 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent err = ARCHIVE_WARN; } else { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p == NULL - || pax_attribute_RHT_security_selinux(entry, p, value_length)) { + if (p == NULL) { + archive_set_error(&a->archive, EINVAL, + "Truncated archive" + " detected while reading selinux data"); + return (ARCHIVE_FATAL); + } + if (pax_attribute_RHT_security_selinux(entry, p, value_length)) { /* TODO: Unable to parse xattr */ err = ARCHIVE_WARN; } @@ -2492,13 +2509,15 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent else if (key_length == 6 && memcmp(key, "fflags", 6) == 0) { if (value_length < fflags_limit) { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p != NULL) { - archive_entry_copy_fflags_text_len(entry, p, value_length); - err = ARCHIVE_OK; - } else { + if (p == NULL) { /* Truncated archive */ - err = ARCHIVE_FATAL; + archive_set_error(&a->archive, EINVAL, + "Truncated archive" + " detected while reading SCHILY.fflags"); + return (ARCHIVE_FATAL); } + archive_entry_copy_fflags_text_len(entry, p, value_length); + err = ARCHIVE_OK; } else { /* Overlong fflags field */ err = ARCHIVE_WARN; @@ -2537,8 +2556,13 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent key += 6; if (value_length < xattr_limit) { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p == NULL - || pax_attribute_SCHILY_xattr(entry, key, key_length, p, value_length)) { + if (p == NULL) { + archive_set_error(&a->archive, EINVAL, + "Truncated archive" + " detected while reading SCHILY.xattr"); + return (ARCHIVE_FATAL); + } + if (pax_attribute_SCHILY_xattr(entry, key, key_length, p, value_length)) { /* TODO: Unable to parse xattr */ err = ARCHIVE_WARN; } @@ -2561,16 +2585,18 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent /* SUN.holesdata */ if (value_length < sparse_map_limit) { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p != NULL) { - err = pax_attribute_SUN_holesdata(a, tar, entry, p, value_length); - if (err < ARCHIVE_OK) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_MISC, - "Parse error: SUN.holesdata"); - } - } else { + if (p == NULL) { + archive_set_error(&a->archive, EINVAL, + "Truncated archive" + " detected while reading SUN.holesdata"); return (ARCHIVE_FATAL); } + err = pax_attribute_SUN_holesdata(a, tar, entry, p, value_length); + if (err < ARCHIVE_OK) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Parse error: SUN.holesdata"); + } } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Unreasonably large sparse map: %d > %d", @@ -2622,26 +2648,25 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent if (key_length == 10 && memcmp(key, "hdrcharset", 10) == 0) { if (value_length < 64) { p = __archive_read_ahead(a, value_length, &bytes_read); - if (p != NULL) { - if (value_length == 6 - && memcmp(p, "BINARY", 6) == 0) { - /* Binary mode. */ - tar->pax_hdrcharset_utf8 = 0; - err = ARCHIVE_OK; - } else if (value_length == 23 - && memcmp(p, "ISO-IR 10646 2000 UTF-8", 23) == 0) { - tar->pax_hdrcharset_utf8 = 1; - err = ARCHIVE_OK; - } else { - /* TODO: Unrecognized character set */ - err = ARCHIVE_WARN; - } - } else { + if (p == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated tar archive " "detected while reading hdrcharset attribute"); return (ARCHIVE_FATAL); } + if (value_length == 6 + && memcmp(p, "BINARY", 6) == 0) { + /* Binary mode. */ + tar->pax_hdrcharset_utf8 = 0; + err = ARCHIVE_OK; + } else if (value_length == 23 + && memcmp(p, "ISO-IR 10646 2000 UTF-8", 23) == 0) { + tar->pax_hdrcharset_utf8 = 1; + err = ARCHIVE_OK; + } else { + /* TODO: Unrecognized character set */ + err = ARCHIVE_WARN; + } } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "hdrcharset attribute is unreasonably large (%d bytes)", @@ -2909,7 +2934,7 @@ gnu_add_sparse_entry(struct archive_read *a, struct tar *tar, { struct sparse_block *p; - p = (struct sparse_block *)calloc(1, sizeof(*p)); + p = calloc(1, sizeof(*p)); if (p == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); return (ARCHIVE_FATAL); @@ -2974,9 +2999,7 @@ gnu_sparse_old_read(struct archive_read *a, struct tar *tar, do { tar_flush_unconsumed(a, unconsumed); data = __archive_read_ahead(a, 512, &bytes_read); - if (bytes_read < 0) - return (ARCHIVE_FATAL); - if (bytes_read < 512) { + if (data == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated tar archive " "detected while reading sparse file data"); @@ -3396,7 +3419,7 @@ readline(struct archive_read *a, struct tar *tar, const char **start, tar_flush_unconsumed(a, unconsumed); t = __archive_read_ahead(a, 1, &bytes_read); - if (bytes_read <= 0) + if (bytes_read <= 0 || t == NULL) return (ARCHIVE_FATAL); s = t; /* Start of line? */ p = memchr(t, '\n', bytes_read); @@ -3437,7 +3460,7 @@ readline(struct archive_read *a, struct tar *tar, const char **start, } /* Read some more. */ t = __archive_read_ahead(a, 1, &bytes_read); - if (bytes_read <= 0) + if (bytes_read <= 0 || t == NULL) return (ARCHIVE_FATAL); s = t; /* Start of line? */ p = memchr(t, '\n', bytes_read); @@ -3481,7 +3504,7 @@ base64_decode(const char *s, size_t len, size_t *out_len) /* Allocate enough space to hold the entire output. */ /* Note that we may not use all of this... */ - out = (char *)malloc(len - len / 4 + 1); + out = malloc(len - len / 4 + 1); if (out == NULL) { *out_len = 0; return (NULL); @@ -3536,7 +3559,7 @@ url_decode(const char *in, size_t length) char *out, *d; const char *s; - out = (char *)malloc(length + 1); + out = malloc(length + 1); if (out == NULL) return (NULL); for (s = in, d = out; length > 0 && *s != '\0'; ) { diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c index 7c327e02f9cf..ffffab9638ad 100644 --- a/libarchive/archive_read_support_format_xar.c +++ b/libarchive/archive_read_support_format_xar.c @@ -450,7 +450,7 @@ archive_read_support_format_xar(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_xar"); - xar = (struct xar *)calloc(1, sizeof(*xar)); + xar = calloc(1, sizeof(*xar)); if (xar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate xar data"); diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 689346882ec7..3e62533bf2d9 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -1751,8 +1751,7 @@ zipx_xz_init(struct archive_read *a, struct zip *zip) free(zip->uncompressed_buffer); zip->uncompressed_buffer_size = 256 * 1024; - zip->uncompressed_buffer = - (uint8_t*) malloc(zip->uncompressed_buffer_size); + zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size); if (zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory for xz decompression"); @@ -1862,8 +1861,7 @@ zipx_lzma_alone_init(struct archive_read *a, struct zip *zip) if(!zip->uncompressed_buffer) { zip->uncompressed_buffer_size = 256 * 1024; - zip->uncompressed_buffer = - (uint8_t*) malloc(zip->uncompressed_buffer_size); + zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size); if (zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, @@ -2167,8 +2165,7 @@ zipx_ppmd8_init(struct archive_read *a, struct zip *zip) free(zip->uncompressed_buffer); zip->uncompressed_buffer_size = 256 * 1024; - zip->uncompressed_buffer = - (uint8_t*) malloc(zip->uncompressed_buffer_size); + zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size); if(zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, @@ -2291,8 +2288,7 @@ zipx_bzip2_init(struct archive_read *a, struct zip *zip) free(zip->uncompressed_buffer); zip->uncompressed_buffer_size = 256 * 1024; - zip->uncompressed_buffer = - (uint8_t*) malloc(zip->uncompressed_buffer_size); + zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size); if (zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory for bzip2 decompression"); @@ -2434,8 +2430,7 @@ zipx_zstd_init(struct archive_read *a, struct zip *zip) free(zip->uncompressed_buffer); zip->uncompressed_buffer_size = ZSTD_DStreamOutSize(); - zip->uncompressed_buffer = - (uint8_t*) malloc(zip->uncompressed_buffer_size); + zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size); if (zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory for Zstd decompression"); @@ -2574,7 +2569,7 @@ zip_read_data_deflate(struct archive_read *a, const void **buff, if (zip->uncompressed_buffer == NULL) { zip->uncompressed_buffer_size = 256 * 1024; zip->uncompressed_buffer - = (unsigned char *)malloc(zip->uncompressed_buffer_size); + = malloc(zip->uncompressed_buffer_size); if (zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory for ZIP decompression"); @@ -3600,7 +3595,7 @@ archive_read_support_format_zip_streamable(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_zip"); - zip = (struct zip *)calloc(1, sizeof(*zip)); + zip = calloc(1, sizeof(*zip)); if (zip == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate zip data"); @@ -4392,7 +4387,7 @@ archive_read_support_format_zip_seekable(struct archive *_a) archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_support_format_zip_seekable"); - zip = (struct zip *)calloc(1, sizeof(*zip)); + zip = calloc(1, sizeof(*zip)); if (zip == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate zip data"); diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 41bfe7af1d96..abf7ad669351 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -313,7 +313,7 @@ archive_string_ensure(struct archive_string *as, size_t s) if (new_length < s) new_length = s; /* Now we can reallocate the buffer. */ - p = (char *)realloc(as->s, new_length); + p = realloc(as->s, new_length); if (p == NULL) { /* On failure, wipe the string and return NULL. */ archive_string_free(as); diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c index 46d03f926def..3a8caad5262b 100644 --- a/libarchive/archive_util.c +++ b/libarchive/archive_util.c @@ -651,8 +651,7 @@ archive_utility_string_sort_helper(char **strings, unsigned int n) if (strcmp(strings[i], pivot) < 0) { lesser_count++; - tmp = (char **)realloc(lesser, - lesser_count * sizeof(char *)); + tmp = realloc(lesser, lesser_count * sizeof(*tmp)); if (!tmp) { free(greater); free(lesser); @@ -664,8 +663,7 @@ archive_utility_string_sort_helper(char **strings, unsigned int n) else { greater_count++; - tmp = (char **)realloc(greater, - greater_count * sizeof(char *)); + tmp = realloc(greater, greater_count * sizeof(*tmp)); if (!tmp) { free(greater); free(lesser); diff --git a/libarchive/archive_write.c b/libarchive/archive_write.c index e1a4f34bfc3c..303c686881a9 100644 --- a/libarchive/archive_write.c +++ b/libarchive/archive_write.c @@ -98,7 +98,7 @@ archive_write_new(void) struct archive_write *a; unsigned char *nulls; - a = (struct archive_write *)calloc(1, sizeof(*a)); + a = calloc(1, sizeof(*a)); if (a == NULL) return (NULL); a->archive.magic = ARCHIVE_WRITE_MAGIC; @@ -114,7 +114,7 @@ archive_write_new(void) /* Initialize a block of nulls for padding purposes. */ a->null_length = 1024; - nulls = (unsigned char *)calloc(a->null_length, sizeof(unsigned char)); + nulls = calloc(a->null_length, sizeof(unsigned char)); if (nulls == NULL) { free(a); return (NULL); @@ -367,8 +367,8 @@ archive_write_client_open(struct archive_write_filter *f) archive_write_get_bytes_in_last_block(f->archive); buffer_size = f->bytes_per_block; - state = (struct archive_none *)calloc(1, sizeof(*state)); - buffer = (char *)malloc(buffer_size); + state = calloc(1, sizeof(*state)); + buffer = malloc(buffer_size); if (state == NULL || buffer == NULL) { free(state); free(buffer); diff --git a/libarchive/archive_write_add_filter_b64encode.c b/libarchive/archive_write_add_filter_b64encode.c index 3aca6d81d221..2c361bfb974e 100644 --- a/libarchive/archive_write_add_filter_b64encode.c +++ b/libarchive/archive_write_add_filter_b64encode.c @@ -85,7 +85,7 @@ archive_write_add_filter_b64encode(struct archive *_a) archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_NEW, "archive_write_add_filter_b64encode"); - state = (struct private_b64encode *)calloc(1, sizeof(*state)); + state = calloc(1, sizeof(*state)); if (state == NULL) { archive_set_error(f->archive, ENOMEM, "Can't allocate data for b64encode filter"); diff --git a/libarchive/archive_write_add_filter_bzip2.c b/libarchive/archive_write_add_filter_bzip2.c index bc0ef2607127..0726f08936ec 100644 --- a/libarchive/archive_write_add_filter_bzip2.c +++ b/libarchive/archive_write_add_filter_bzip2.c @@ -177,8 +177,7 @@ archive_compressor_bzip2_open(struct archive_write_filter *f) bs -= bs % bpb; } data->compressed_buffer_size = bs; - data->compressed - = (char *)malloc(data->compressed_buffer_size); + data->compressed = malloc(data->compressed_buffer_size); if (data->compressed == NULL) { archive_set_error(f->archive, ENOMEM, "Can't allocate data for compression buffer"); diff --git a/libarchive/archive_write_add_filter_compress.c b/libarchive/archive_write_add_filter_compress.c index e547e8872860..a54a85754293 100644 --- a/libarchive/archive_write_add_filter_compress.c +++ b/libarchive/archive_write_add_filter_compress.c @@ -150,7 +150,7 @@ archive_compressor_compress_open(struct archive_write_filter *f) f->code = ARCHIVE_FILTER_COMPRESS; f->name = "compress"; - state = (struct private_data *)calloc(1, sizeof(*state)); + state = calloc(1, sizeof(*state)); if (state == NULL) { archive_set_error(f->archive, ENOMEM, "Can't allocate data for compression"); diff --git a/libarchive/archive_write_add_filter_gzip.c b/libarchive/archive_write_add_filter_gzip.c index a7fabbfa6bd5..71d7891261a5 100644 --- a/libarchive/archive_write_add_filter_gzip.c +++ b/libarchive/archive_write_add_filter_gzip.c @@ -194,8 +194,7 @@ archive_compressor_gzip_open(struct archive_write_filter *f) bs -= bs % bpb; } data->compressed_buffer_size = bs; - data->compressed - = (unsigned char *)malloc(data->compressed_buffer_size); + data->compressed = malloc(data->compressed_buffer_size); if (data->compressed == NULL) { archive_set_error(f->archive, ENOMEM, "Can't allocate data for compression buffer"); diff --git a/libarchive/archive_write_add_filter_uuencode.c b/libarchive/archive_write_add_filter_uuencode.c index 42dec8def1f1..50bfeb6eaa60 100644 --- a/libarchive/archive_write_add_filter_uuencode.c +++ b/libarchive/archive_write_add_filter_uuencode.c @@ -74,7 +74,7 @@ archive_write_add_filter_uuencode(struct archive *_a) archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_NEW, "archive_write_add_filter_uu"); - state = (struct private_uuencode *)calloc(1, sizeof(*state)); + state = calloc(1, sizeof(*state)); if (state == NULL) { archive_set_error(f->archive, ENOMEM, "Can't allocate data for uuencode filter"); diff --git a/libarchive/archive_write_add_filter_xz.c b/libarchive/archive_write_add_filter_xz.c index e09d5e917393..098f0c95570b 100644 --- a/libarchive/archive_write_add_filter_xz.c +++ b/libarchive/archive_write_add_filter_xz.c @@ -319,8 +319,7 @@ archive_compressor_xz_open(struct archive_write_filter *f) bs -= bs % bpb; } data->compressed_buffer_size = bs; - data->compressed - = (unsigned char *)malloc(data->compressed_buffer_size); + data->compressed = malloc(data->compressed_buffer_size); if (data->compressed == NULL) { archive_set_error(f->archive, ENOMEM, "Can't allocate data for compression buffer"); diff --git a/libarchive/archive_write_add_filter_zstd.c b/libarchive/archive_write_add_filter_zstd.c index 7ea3d18c9b76..c0a6e5a37a66 100644 --- a/libarchive/archive_write_add_filter_zstd.c +++ b/libarchive/archive_write_add_filter_zstd.c @@ -372,8 +372,7 @@ archive_compressor_zstd_open(struct archive_write_filter *f) } data->out.size = bs; data->out.pos = 0; - data->out.dst - = (unsigned char *)malloc(data->out.size); + data->out.dst = malloc(data->out.size); if (data->out.dst == NULL) { archive_set_error(f->archive, ENOMEM, "Can't allocate data for compression buffer"); diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index 098a8fe4113f..d9619fe2d122 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -1991,7 +1991,7 @@ archive_write_disk_new(void) { struct archive_write_disk *a; - a = (struct archive_write_disk *)calloc(1, sizeof(*a)); + a = calloc(1, sizeof(*a)); if (a == NULL) return (NULL); a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC; @@ -2758,7 +2758,7 @@ new_fixup(struct archive_write_disk *a, const char *pathname) { struct fixup_entry *fe; - fe = (struct fixup_entry *)calloc(1, sizeof(struct fixup_entry)); + fe = calloc(1, sizeof(struct fixup_entry)); if (fe == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate memory for a fixup"); diff --git a/libarchive/archive_write_disk_windows.c b/libarchive/archive_write_disk_windows.c index 774151ae22b9..086f796938c7 100644 --- a/libarchive/archive_write_disk_windows.c +++ b/libarchive/archive_write_disk_windows.c @@ -1362,23 +1362,23 @@ archive_write_disk_set_user_lookup(struct archive *_a, int64_t archive_write_disk_gid(struct archive *_a, const char *name, la_int64_t id) { - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_gid"); - if (a->lookup_gid) - return (a->lookup_gid)(a->lookup_gid_data, name, id); - return (id); + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_gid"); + if (a->lookup_gid) + return (a->lookup_gid)(a->lookup_gid_data, name, id); + return (id); } int64_t archive_write_disk_uid(struct archive *_a, const char *name, la_int64_t id) { - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_uid"); - if (a->lookup_uid) - return (a->lookup_uid)(a->lookup_uid_data, name, id); - return (id); + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_uid"); + if (a->lookup_uid) + return (a->lookup_uid)(a->lookup_uid_data, name, id); + return (id); } /* @@ -1389,7 +1389,7 @@ archive_write_disk_new(void) { struct archive_write_disk *a; - a = (struct archive_write_disk *)calloc(1, sizeof(*a)); + a = calloc(1, sizeof(*a)); if (a == NULL) return (NULL); a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC; @@ -2079,7 +2079,7 @@ new_fixup(struct archive_write_disk *a, const wchar_t *pathname) { struct fixup_entry *fe; - fe = (struct fixup_entry *)calloc(1, sizeof(struct fixup_entry)); + fe = calloc(1, sizeof(struct fixup_entry)); if (fe == NULL) return (NULL); fe->next = a->fixup_list; @@ -2243,13 +2243,15 @@ guidword(wchar_t *p, int n) * Canonicalize the pathname. In particular, this strips duplicate * '\' characters, '.' elements, and trailing '\'. It also raises an * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is - * set) any '..' in the path. + * set) any '..' in the path or (if ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) + * if the path is absolute. */ static int cleanup_pathname(struct archive_write_disk *a, wchar_t *name) { wchar_t *dest, *src, *p, *top; wchar_t separator = L'\0'; + BOOL absolute_path = 0; p = name; if (*p == L'\0') { @@ -2271,6 +2273,8 @@ cleanup_pathname(struct archive_write_disk *a, wchar_t *name) if (p[0] == L'\\' && p[1] == L'\\' && (p[2] == L'.' || p[2] == L'?') && p[3] == L'\\') { + absolute_path = 1; + /* A path begin with "\\?\UNC\" */ if (p[2] == L'?' && (p[4] == L'U' || p[4] == L'u') && @@ -2318,9 +2322,10 @@ cleanup_pathname(struct archive_write_disk *a, wchar_t *name) return (ARCHIVE_FAILED); } else p += 4; - /* Network drive path like "\\\\file" */ - } else if (p[0] == L'\\' && p[1] == L'\\') { - p += 2; + /* Network drive path like "\\\\file" */ + } else if (p[0] == L'\\' && p[1] == L'\\') { + absolute_path = 1; + p += 2; } /* Skip leading drive letter from archives created @@ -2333,10 +2338,18 @@ cleanup_pathname(struct archive_write_disk *a, wchar_t *name) "Path is a drive name"); return (ARCHIVE_FAILED); } + + absolute_path = 1; + if (p[2] == L'\\') p += 2; } + if (absolute_path && (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Path is absolute"); + return (ARCHIVE_FAILED); + } + top = dest = src = p; /* Rewrite the path name if its character is a unusable. */ for (; *p != L'\0'; p++) { @@ -2829,7 +2842,7 @@ set_fflags(struct archive_write_disk *a) return (ARCHIVE_OK); return (set_fflags_platform(a->name, set, clear)); - } + } return (ARCHIVE_OK); } diff --git a/libarchive/archive_write_open_fd.c b/libarchive/archive_write_open_fd.c index a58ae047967b..8a3f68d0699d 100644 --- a/libarchive/archive_write_open_fd.c +++ b/libarchive/archive_write_open_fd.c @@ -62,7 +62,7 @@ archive_write_open_fd(struct archive *a, int fd) { struct write_fd_data *mine; - mine = (struct write_fd_data *)malloc(sizeof(*mine)); + mine = malloc(sizeof(*mine)); if (mine == NULL) { archive_set_error(a, ENOMEM, "No memory"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_open_file.c b/libarchive/archive_write_open_file.c index d787da3af388..4c6ebfb2269d 100644 --- a/libarchive/archive_write_open_file.c +++ b/libarchive/archive_write_open_file.c @@ -59,7 +59,7 @@ archive_write_open_FILE(struct archive *a, FILE *f) { struct write_FILE_data *mine; - mine = (struct write_FILE_data *)malloc(sizeof(*mine)); + mine = malloc(sizeof(*mine)); if (mine == NULL) { archive_set_error(a, ENOMEM, "No memory"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_open_filename.c b/libarchive/archive_write_open_filename.c index 7dc73d55f43e..6842b98d2f07 100644 --- a/libarchive/archive_write_open_filename.c +++ b/libarchive/archive_write_open_filename.c @@ -98,7 +98,7 @@ open_filename(struct archive *a, int mbs_fn, const void *filename) struct write_file_data *mine; int r; - mine = (struct write_file_data *)calloc(1, sizeof(*mine)); + mine = calloc(1, sizeof(*mine)); if (mine == NULL) { archive_set_error(a, ENOMEM, "No memory"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_open_memory.c b/libarchive/archive_write_open_memory.c index 609cc47d964a..e31650447279 100644 --- a/libarchive/archive_write_open_memory.c +++ b/libarchive/archive_write_open_memory.c @@ -52,7 +52,7 @@ archive_write_open_memory(struct archive *a, void *buff, size_t buffSize, size_t { struct write_memory_data *mine; - mine = (struct write_memory_data *)calloc(1, sizeof(*mine)); + mine = calloc(1, sizeof(*mine)); if (mine == NULL) { archive_set_error(a, ENOMEM, "No memory"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_set_format_7zip.c b/libarchive/archive_write_set_format_7zip.c index c0ea9d6b1548..b870338fc025 100644 --- a/libarchive/archive_write_set_format_7zip.c +++ b/libarchive/archive_write_set_format_7zip.c @@ -521,7 +521,7 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry) */ if (archive_entry_filetype(entry) == AE_IFLNK) { ssize_t bytes; - const void *p = (const void *)archive_entry_symlink(entry); + const void *p = (const void *)archive_entry_symlink_utf8(entry); bytes = compress_out(a, p, (size_t)file->size, ARCHIVE_Z_RUN); if (bytes < 0) return ((int)bytes); @@ -1563,8 +1563,18 @@ file_new(struct archive_write *a, struct archive_entry *entry, archive_entry_set_size(entry, 0); if (archive_entry_filetype(entry) == AE_IFDIR) file->dir = 1; - else if (archive_entry_filetype(entry) == AE_IFLNK) - file->size = strlen(archive_entry_symlink(entry)); + else if (archive_entry_filetype(entry) == AE_IFLNK) { + const char* linkpath; + linkpath = archive_entry_symlink_utf8(entry); + if (linkpath == NULL) { + free(file); + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "symlink path could not be converted to UTF-8"); + return (ARCHIVE_FAILED); + } + else + file->size = strlen(linkpath); + } if (archive_entry_mtime_is_set(entry)) { file->flg |= MTIME_IS_SET; file->times[MTIME].time = archive_entry_mtime(entry); diff --git a/libarchive/archive_write_set_format_ar.c b/libarchive/archive_write_set_format_ar.c index 38689d89be0e..e5e9c806b639 100644 --- a/libarchive/archive_write_set_format_ar.c +++ b/libarchive/archive_write_set_format_ar.c @@ -126,7 +126,7 @@ archive_write_set_format_ar(struct archive_write *a) if (a->format_free != NULL) (a->format_free)(a); - ar = (struct ar_w *)calloc(1, sizeof(*ar)); + ar = calloc(1, sizeof(*ar)); if (ar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate ar data"); return (ARCHIVE_FATAL); @@ -246,7 +246,7 @@ archive_write_ar_header(struct archive_write *a, struct archive_entry *entry) return (ARCHIVE_WARN); } - se = (char *)malloc(strlen(filename) + 3); + se = malloc(strlen(filename) + 3); if (se == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate filename buffer"); @@ -379,7 +379,7 @@ archive_write_ar_data(struct archive_write *a, const void *buff, size_t s) return (ARCHIVE_WARN); } - ar->strtab = (char *)malloc(s + 1); + ar->strtab = malloc(s + 1); if (ar->strtab == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate strtab buffer"); diff --git a/libarchive/archive_write_set_format_cpio_binary.c b/libarchive/archive_write_set_format_cpio_binary.c index a22d06ea3838..aefb2ca6f514 100644 --- a/libarchive/archive_write_set_format_cpio_binary.c +++ b/libarchive/archive_write_set_format_cpio_binary.c @@ -185,7 +185,7 @@ archive_write_set_format_cpio_binary(struct archive *_a, int format) if (a->format_free != NULL) (a->format_free)(a); - cpio = (struct cpio *)calloc(1, sizeof(*cpio)); + cpio = calloc(1, sizeof(*cpio)); if (cpio == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_set_format_cpio_newc.c b/libarchive/archive_write_set_format_cpio_newc.c index 006736a1fa22..254d5a9901c3 100644 --- a/libarchive/archive_write_set_format_cpio_newc.c +++ b/libarchive/archive_write_set_format_cpio_newc.c @@ -116,7 +116,7 @@ archive_write_set_format_cpio_newc(struct archive *_a) if (a->format_free != NULL) (a->format_free)(a); - cpio = (struct cpio *)calloc(1, sizeof(*cpio)); + cpio = calloc(1, sizeof(*cpio)); if (cpio == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_set_format_cpio_odc.c b/libarchive/archive_write_set_format_cpio_odc.c index 6dce78b45452..c72c6b2796bf 100644 --- a/libarchive/archive_write_set_format_cpio_odc.c +++ b/libarchive/archive_write_set_format_cpio_odc.c @@ -110,7 +110,7 @@ archive_write_set_format_cpio_odc(struct archive *_a) if (a->format_free != NULL) (a->format_free)(a); - cpio = (struct cpio *)calloc(1, sizeof(*cpio)); + cpio = calloc(1, sizeof(*cpio)); if (cpio == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_set_format_gnutar.c b/libarchive/archive_write_set_format_gnutar.c index 8979078ee4bb..04b190de4402 100644 --- a/libarchive/archive_write_set_format_gnutar.c +++ b/libarchive/archive_write_set_format_gnutar.c @@ -174,7 +174,7 @@ archive_write_set_format_gnutar(struct archive *_a) struct archive_write *a = (struct archive_write *)_a; struct gnutar *gnutar; - gnutar = (struct gnutar *)calloc(1, sizeof(*gnutar)); + gnutar = calloc(1, sizeof(*gnutar)); if (gnutar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate gnutar data"); diff --git a/libarchive/archive_write_set_format_pax.c b/libarchive/archive_write_set_format_pax.c index 4aace4682587..6e35f705e136 100644 --- a/libarchive/archive_write_set_format_pax.c +++ b/libarchive/archive_write_set_format_pax.c @@ -138,7 +138,7 @@ archive_write_set_format_pax(struct archive *_a) if (a->format_free != NULL) (a->format_free)(a); - pax = (struct pax *)calloc(1, sizeof(*pax)); + pax = calloc(1, sizeof(*pax)); if (pax == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate pax data"); @@ -1944,7 +1944,7 @@ url_encode(const char *in) } } - out = (char *)malloc(out_len + 1); + out = malloc(out_len + 1); if (out == NULL) return (NULL); @@ -1982,7 +1982,7 @@ base64_encode(const char *s, size_t len) char *d, *out; /* 3 bytes becomes 4 chars, but round up and allow for trailing NUL */ - out = (char *)malloc((len * 4 + 2) / 3 + 1); + out = malloc((len * 4 + 2) / 3 + 1); if (out == NULL) return (NULL); d = out; @@ -2037,7 +2037,7 @@ _sparse_list_add_block(struct pax *pax, int64_t offset, int64_t length, { struct sparse_block *sb; - sb = (struct sparse_block *)malloc(sizeof(*sb)); + sb = malloc(sizeof(*sb)); if (sb == NULL) return (ARCHIVE_FATAL); sb->next = NULL; diff --git a/libarchive/archive_write_set_format_raw.c b/libarchive/archive_write_set_format_raw.c index feff93697736..ff3e9ae0ebdb 100644 --- a/libarchive/archive_write_set_format_raw.c +++ b/libarchive/archive_write_set_format_raw.c @@ -58,7 +58,7 @@ archive_write_set_format_raw(struct archive *_a) if (a->format_free != NULL) (a->format_free)(a); - raw = (struct raw *)calloc(1, sizeof(*raw)); + raw = calloc(1, sizeof(*raw)); if (raw == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate raw data"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_set_format_shar.c b/libarchive/archive_write_set_format_shar.c index da2bc0ca3edb..be9f78ce96cd 100644 --- a/libarchive/archive_write_set_format_shar.c +++ b/libarchive/archive_write_set_format_shar.c @@ -113,7 +113,7 @@ archive_write_set_format_shar(struct archive *_a) if (a->format_free != NULL) (a->format_free)(a); - shar = (struct shar *)calloc(1, sizeof(*shar)); + shar = calloc(1, sizeof(*shar)); if (shar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate shar data"); return (ARCHIVE_FATAL); diff --git a/libarchive/archive_write_set_format_ustar.c b/libarchive/archive_write_set_format_ustar.c index 9dc6e71f189f..09b71fe6672a 100644 --- a/libarchive/archive_write_set_format_ustar.c +++ b/libarchive/archive_write_set_format_ustar.c @@ -183,7 +183,7 @@ archive_write_set_format_ustar(struct archive *_a) return (ARCHIVE_FATAL); } - ustar = (struct ustar *)calloc(1, sizeof(*ustar)); + ustar = calloc(1, sizeof(*ustar)); if (ustar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate ustar data"); diff --git a/libarchive/archive_write_set_format_v7tar.c b/libarchive/archive_write_set_format_v7tar.c index ffb420f08ba1..2598fc076c0c 100644 --- a/libarchive/archive_write_set_format_v7tar.c +++ b/libarchive/archive_write_set_format_v7tar.c @@ -160,7 +160,7 @@ archive_write_set_format_v7tar(struct archive *_a) return (ARCHIVE_FATAL); } - v7tar = (struct v7tar *)calloc(1, sizeof(*v7tar)); + v7tar = calloc(1, sizeof(*v7tar)); if (v7tar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate v7tar data"); diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index ad3e90759176..a9f2877305e8 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -456,7 +456,7 @@ archive_write_set_format_zip(struct archive *_a) if (a->format_free != NULL) (a->format_free)(a); - zip = (struct zip *) calloc(1, sizeof(*zip)); + zip = calloc(1, sizeof(*zip)); if (zip == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate zip data"); diff --git a/libarchive/test/CMakeLists.txt b/libarchive/test/CMakeLists.txt index 4b7e21fc20fe..314c972d26a6 100644 --- a/libarchive/test/CMakeLists.txt +++ b/libarchive/test/CMakeLists.txt @@ -9,6 +9,7 @@ IF(ENABLE_TEST) ../../test_utils/test_main.c read_open_memory.c test.h + test_7zip_filename_encoding.c test_acl_nfs4.c test_acl_pax.c test_acl_platform_nfs4.c @@ -94,6 +95,7 @@ IF(ENABLE_TEST) test_read_file_nonexistent.c test_read_filter_compress.c test_read_filter_grzip.c + test_read_filter_gzip_recursive.c test_read_filter_lrzip.c test_read_filter_lzop.c test_read_filter_lzop_multiple_parts.c @@ -153,6 +155,7 @@ IF(ENABLE_TEST) test_read_format_mtree_crash747.c test_read_format_pax_bz2.c test_read_format_rar.c + test_read_format_rar_encryption.c test_read_format_rar_encryption_data.c test_read_format_rar_encryption_header.c test_read_format_rar_encryption_partially.c @@ -226,6 +229,7 @@ IF(ENABLE_TEST) test_write_disk_no_hfs_compression.c test_write_disk_perms.c test_write_disk_secure.c + test_write_disk_secure_noabsolutepaths.c test_write_disk_secure744.c test_write_disk_secure745.c test_write_disk_secure746.c diff --git a/libarchive/test/test_7zip_filename_encoding.c b/libarchive/test/test_7zip_filename_encoding.c new file mode 100644 index 000000000000..cf562d39fda7 --- /dev/null +++ b/libarchive/test/test_7zip_filename_encoding.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2003-2018 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" + +DEFINE_TEST(test_7zip_filename_encoding_UTF16_win) +{ +#if !defined(_WIN32) || defined(__CYGWIN__) + skipping("This test is meant to verify unicode string handling" + " on Windows with UTF-16 names"); + return; +#else + struct archive *a; + struct archive_entry *entry; + char buff[4096]; + size_t used; + + /* + * Don't call setlocale because we're verifying that the '_w' functions + * work as expected + */ + + a = archive_write_new(); + assertEqualInt(ARCHIVE_OK, archive_write_set_format_7zip(a)); + assertEqualInt(ARCHIVE_OK, + archive_write_open_memory(a, buff, sizeof(buff), &used)); + + /* Part 1: file */ + entry = archive_entry_new2(a); + archive_entry_copy_pathname_w(entry, L"\u8868.txt"); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_size(entry, 0); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry)); + + /* Part 2: directory */ + archive_entry_clear(entry); + archive_entry_copy_pathname_w(entry, L"\u8868"); + archive_entry_set_filetype(entry, AE_IFDIR); + archive_entry_set_size(entry, 0); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry)); + + /* Part 3: symlink */ + archive_entry_clear(entry); + archive_entry_set_pathname(entry, "link.txt"); + archive_entry_copy_symlink_w(entry, L"\u8868.txt"); + archive_entry_set_filetype(entry, AE_IFLNK); + archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE); + archive_entry_set_size(entry, 0); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry)); + + /* NOTE: 7zip does not support hardlinks */ + + archive_entry_free(entry); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Ensure that the archive contents can be read properly */ + /* NOTE: 7zip file contents are not in the order we wrote them! */ + a = archive_read_new(); + archive_read_support_format_all(a); + archive_read_support_filter_all(a); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + + /* Read part 3: symlink */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry)); + assertEqualWString(L"\u8868.txt", archive_entry_symlink_w(entry)); + + /* Read part 1: file */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry)); + assertEqualWString(L"\u8868.txt", archive_entry_pathname_w(entry)); + + /* Read part 2: directory */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry)); + /* NOTE: Trailing slash added automatically for us */ + assertEqualWString(L"\u8868/", archive_entry_pathname_w(entry)); + + archive_read_free(a); +#endif +} \ No newline at end of file diff --git a/libarchive/test/test_archive_read_multiple_data_objects.c b/libarchive/test/test_archive_read_multiple_data_objects.c index f5adb5b7b567..f9f75d96fa6b 100644 --- a/libarchive/test/test_archive_read_multiple_data_objects.c +++ b/libarchive/test/test_archive_read_multiple_data_objects.c @@ -184,7 +184,7 @@ file_open(struct archive *a, void *data) mydata->fd = open(mydata->filename, O_RDONLY | O_BINARY); if (mydata->fd >= 0) { - if ((mydata->buffer = (void*)calloc(BLOCK_SIZE, 1)) == NULL) + if ((mydata->buffer = calloc(BLOCK_SIZE, 1)) == NULL) return (ARCHIVE_FAILED); } } @@ -280,28 +280,21 @@ test_customized_multiple_data_objects(void) for (i = 0; filename != NULL;) { - assert((mydata = (struct mydata *)calloc(1, sizeof(*mydata))) != NULL); + assert((mydata = calloc(1, sizeof(*mydata))) != NULL); if (mydata == NULL) { assertEqualInt(ARCHIVE_OK, archive_read_free(a)); return; } - assert((mydata->filename = - (char *)calloc(strlen(filename) + 1, sizeof(char))) != NULL); - if (mydata->filename == NULL) { - free(mydata); - assertEqualInt(ARCHIVE_OK, archive_read_free(a)); - return; - } - strcpy(mydata->filename, filename); + assert((mydata->filename = strdup(filename)) != NULL); mydata->fd = -1; filename = reffiles[++i]; assertA(0 == archive_read_append_callback_data(a, mydata)); } - assertA(0 == archive_read_set_open_callback(a, file_open)); - assertA(0 == archive_read_set_read_callback(a, file_read)); - assertA(0 == archive_read_set_skip_callback(a, file_skip)); - assertA(0 == archive_read_set_close_callback(a, file_close)); - assertA(0 == archive_read_set_switch_callback(a, file_switch)); + assertA(0 == archive_read_set_open_callback(a, file_open)); + assertA(0 == archive_read_set_read_callback(a, file_read)); + assertA(0 == archive_read_set_skip_callback(a, file_skip)); + assertA(0 == archive_read_set_close_callback(a, file_close)); + assertA(0 == archive_read_set_switch_callback(a, file_switch)); assertA(0 == archive_read_set_seek_callback(a, file_seek)); assertA(0 == archive_read_open1(a)); diff --git a/libarchive/test/test_archive_string.c b/libarchive/test/test_archive_string.c index f8f1e337bf73..30f7a800eae8 100644 --- a/libarchive/test/test_archive_string.c +++ b/libarchive/test/test_archive_string.c @@ -405,7 +405,7 @@ DEFINE_TEST(test_archive_string_sort) srand((unsigned int)time(NULL)); size = sizeof(strings) / sizeof(char *); - assert((test_strings = (char **)calloc(size, sizeof(char *))) != NULL); + assert((test_strings = calloc(size, sizeof(char *))) != NULL); for (i = 0; i < (size - 1); i++) assert((test_strings[i] = strdup(strings[i])) != NULL); diff --git a/libarchive/test/test_archive_write_add_filter_by_name.c b/libarchive/test/test_archive_write_add_filter_by_name.c index c80e161c3b58..9d7e58d6f635 100644 --- a/libarchive/test/test_archive_write_add_filter_by_name.c +++ b/libarchive/test/test_archive_write_add_filter_by_name.c @@ -36,7 +36,7 @@ test_filter_by_name(const char *filter_name, int filter_code, char *buff; int r; - assert((buff = calloc(buffsize, sizeof(char))) != NULL); + assert((buff = calloc(buffsize, sizeof(*buff))) != NULL); if (buff == NULL) return; diff --git a/libarchive/test/test_read_filter_gzip_recursive.c b/libarchive/test/test_read_filter_gzip_recursive.c new file mode 100644 index 000000000000..0042a0511d5a --- /dev/null +++ b/libarchive/test/test_read_filter_gzip_recursive.c @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2003-2024 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" + +DEFINE_TEST(test_read_filter_gzip_recursive) +{ + const char *name = "test_read_filter_gzip_recursive.gz"; + struct archive *a; + + if (!canGzip()) { + skipping("gzip not available"); + return; + } + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_FATAL, + archive_read_open_filename(a, name, 200)); + + /* Verify that the filter detection worked. */ + assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_GZIP); + assertEqualString(archive_filter_name(a, 0), "gzip"); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_filter_gzip_recursive.gz.uu b/libarchive/test/test_read_filter_gzip_recursive.gz.uu new file mode 100644 index 000000000000..14b0476bed40 --- /dev/null +++ b/libarchive/test/test_read_filter_gzip_recursive.gz.uu @@ -0,0 +1,19 @@ +From oss-fuzz: + +clusterfuzz-testcase-minimized-libarchive_fuzzer-5138261947580416 + +This is a gzip input that expands to a gzip, etc, in such a way that +the "filename" field in the nested gzip header ends up being extremely +large (> 500 MiB). This caused headaches for the gzip filter before I +implemented a sanity limit on filename and comment sizes. + +begin 644 test_read_filter_gzip_recursive.gz +M'XL(`5`M[_<\`'#_``#_'XL("0!D0`GK_W,)&P!P_P``_Q^+"`@(`%$`"0D< +M`'#_``#_'XL($?\'_^_W/`!P_P``_Q^+"`D`9$`)Z_]S[AL`O_<^YC:&$!"7<1_P?__W,)&P!P_P``_Q^+"`@(`%$`"0D<`'#_ +M``#_'XL($?\'_^_W/`!P_P``_Q^+"`D`9$`)Z_\\@'1?CG0DE#(`(``` +M`!(````"A13ZJ6=7=E@=,P4`(````&(N='ATO@(;FGDJBE4`L'*@-,GY]@T0 +M?ZC1UGSKU*2VR-1K@HH>GZZP#?C:ML=$"NKDN\=T()`J`!(````2`````C4] +MFI1N5W98'3`%`"````!C+G1X=`"P/D@M5&AIP!`!P`` +` +end diff --git a/libarchive/test/test_read_format_rar4_encrypted_filenames.rar.uu b/libarchive/test/test_read_format_rar4_encrypted_filenames.rar.uu new file mode 100644 index 000000000000..3d7aa806a86d --- /dev/null +++ b/libarchive/test/test_read_format_rar4_encrypted_filenames.rar.uu @@ -0,0 +1,14 @@ +begin 0744 test_read_format_rar4_encrypted_filenames.rar +M4F%R(1H'`,Z98VT_Z.3*>6<12%741?6_./A +M!:XA!P"B0PS55>+%J)-H$0T!//>$']'-U?_"O=N?_:SNE<^54Z3/[8,M^F?6 +M36)XOUNLS4@\\N@1J#Z/V?J<_XS>CNA21,177HP`` +` +end diff --git a/libarchive/test/test_read_format_rar4_solid_encrypted.rar.uu b/libarchive/test/test_read_format_rar4_solid_encrypted.rar.uu new file mode 100644 index 000000000000..7d73ee86d9ef --- /dev/null +++ b/libarchive/test/test_read_format_rar4_solid_encrypted.rar.uu @@ -0,0 +1,11 @@ +begin 0744 test_read_format_rar4_solid_encrypted.dat +M4F%R(1H'`#O0A-D/\9QH!R+,]AV(8F*MQD3.'2/%M7(05"L]0"P\,C=-24,@`0````$@````(U/9J4;E=V6!TS!0`@````8RYT>'1ILB:< +M@2)@M@"P/D@MD'UA]R2N^_G@1!L-H?V>K-TV=-24,@`0````$@````(EX;HF +M361V6!TS!0`@````9"YT>'2C+AKDKML%S0#P^V&/?J,L#@>!52=M.=PPCAJF +(IL0]>P!`!P`` +` +end diff --git a/libarchive/test/test_read_format_rar4_solid_encrypted_filenames.rar.uu b/libarchive/test/test_read_format_rar4_solid_encrypted_filenames.rar.uu new file mode 100644 index 000000000000..6c28e955d0e1 --- /dev/null +++ b/libarchive/test/test_read_format_rar4_solid_encrypted_filenames.rar.uu @@ -0,0 +1,13 @@ +begin 0744 test_read_format_rar4_solid_encrypted_filenames.rar +M4F%R(1H'`#K9?V[74Q\@?])NR\68105J4BRL3O.E$I*!91X?$@/< +M5C[G2D$``````````!NS=YISD[7`_=#)$A.9/&9<3`&D$(L]$^-&%;!SH,%> +M!NZ:W\)5XCJI<"H7+BND(033Q/J9/18(=/`A%WI]@(`:H>AE`M3T)R8']S%P +MHYCV```````````&TB\_##3K6#@Q+J)RDEJ0$CI"]*R1)8!Q.3B[,7O5NM,] +ME::7;E__N2:-%4-;/D+DA:J@P.L0*I/__*OX77=\L4-&F^""&L'VP9/DK-;$ +MLP``````````1D.3Y0+"D$@9F(IYV&*B<`A2J2$)(C=_X_QEMWE*VK9ITH*U +MAJ@<'P(#"Q($$B!5;EKN@```!6$N +M='AT"@,"?"&$HX)\V@%4:&ES(&ES(&9R;VT@82YT>'1Z07&S4`(#/#`$$B`8 +M1:,"@`,`!6(N='AT,`$``P_'1%[A@/BUG]8K0S<(O%?-^C3?!JM=!=23!W3>',O?)/BTBC$`-[^IL`[?FQGU`50`-SXC7SQ9A\"`PL2!!(@-3V: +ME(````5C+G1X=`H#`CY(Z:Z"?-H!5&AIO6K'>WHPH#`GO%*?2/?-H!VVER]/96CJ;] +?&67IE;,VA30W]2J@TR>'LO7!`C+8JEX==U91`P4$```` +` +end diff --git a/libarchive/test/test_read_format_rar5_encrypted_filenames.rar.uu b/libarchive/test/test_read_format_rar5_encrypted_filenames.rar.uu new file mode 100644 index 000000000000..931240a16d49 --- /dev/null +++ b/libarchive/test/test_read_format_rar5_encrypted_filenames.rar.uu @@ -0,0 +1,19 @@ +begin 0744 test_read_format_rar5_encrypted_filenames.rar +M4F%R(1H'`0"N(]*0(00```$/:`NPT*?(O:'>=*=Q,C2;&;<*@A@[)[D`X\II +M)1#LA,>A'D8M?0XU3L36UDKMZ3EWQ[HCXZ3<%!O*=.Y,W/S,FBUJV)T^1MW,X0)C4P7W(`"$#-N +MQ\V%/Z&YJ=4A7#WA+9.5'__1CF)4F:?SV[[N1U^16P.+TQ5X.'"@NQ"=6K3Z +M>:;.1CVE<%%M1-OQ3L0FZ[KI2TSW`.2SF200V5WTB3-QIV<3Q'?++X$0]?XV(?ER,71CAXBNL1KT5A* +M8*&+T@6]A_)*KA]%V3S,0B;S(LW1V.AH.U6U0N\-%!@J9Q-FJ%^'O)(JR5+2 +MS$5JO/XA3W4MSJ[R27%P_4$GAWSW!SS(4IA_-)Z:[:?V5D!F@TGG9L0!1TF[ +M:AH<9G0.['%7-\:>"&(8Y#Z#62;U.:,3+=<$E6S8C02I[/G>-3P1Y<'J +MW_FJ/]VJ-Q7IA64 +MU:_TK/EHMM;PWJ?3`Y9S6&%6L@T0-U<&4E[+_F>Z%+KFW'&W>`,.=]#SI;A[ +MYA);NM6`5K01J]@IT6O8W#!].A$%_5M\E]S0&.TOPBCL9$C"GU +M2G&8E))@.H01Q:@1Q^.YVYIG(?#2:S604D\'CWU.!:-E`=;4VFS+KULL +KJ<2G@G$-MF5V72TYY!]U(UB473O?`U'=W'#D\4A%S-_F?/@]S)MU>.[V1``` +` +end diff --git a/libarchive/test/test_read_format_rar5_solid_encrypted.rar.uu b/libarchive/test/test_read_format_rar5_solid_encrypted.rar.uu new file mode 100644 index 000000000000..d3113a305917 --- /dev/null +++ b/libarchive/test/test_read_format_rar5_solid_encrypted.rar.uu @@ -0,0 +1,14 @@ +begin 0744 test_read_format_rar5_solid_encrypted.rar +M4F%R(1H'`0`@MOH1"@$%!@0%`0&`@`!A#\6>4@(#/+``!)(`(%5N6NZ`0P`% +M82YT>'0P`0`!#X`.^EM!19`,=C!0B-G+#?0([51UI],+OH^T\:=V\5`OX@\X +M+B?>=W@0'[TD"@,"?"&$HX)\V@$UI92M^>J?V-L?2@`2L023@_#?H\C>K?GG +MDT*27O`>\]$\(4^12SZAD2GI6I(?@NS\ETUG4@(#/)``!)(`(#W[M6/`0P`% +M8BYT>'0P`0`##X`.^EM!19`,=C!0B-G+#?09'G;UMT5!4+;8`6WM=*[?X@\X +M+B?>=W@0'[TD"@,"/[#]2`@,\D``$D@`@>Q=TP\!#``5D+G1X=#`!``,/@`[Z6T%%D`QV +M,%"(V!`?O20*`P)[Q2GTCWS: +9`3G@<$3$LKSYCC7DX.K9`[`==U91`P4$```` +` +end diff --git a/libarchive/test/test_read_format_rar5_solid_encrypted_filenames.rar.uu b/libarchive/test/test_read_format_rar5_solid_encrypted_filenames.rar.uu new file mode 100644 index 000000000000..4f3dbfb33127 --- /dev/null +++ b/libarchive/test/test_read_format_rar5_solid_encrypted_filenames.rar.uu @@ -0,0 +1,18 @@ +begin 0744 test_read_format_rar5_solid_encrypted_filenames.rar +M4F%R(1H'`0";0=T:(00```$/AC5`PSS2$L"IUF$&I":C])K[3<7Y3A09X<`H +M`7''7U?%(MHPZ3W;#Z7PZEC<2`T4N9L0A@JE?=;1"4#J%N#6H+4KYITU<*=Q +MG$W?R7^W[#&LN^@M8(VSG.,@!1JFX359D^5#S[,ZW]V]CJ'J?-Z!KX^]Y1FB +M8I%5/(^2-8V^KY:K1^?K`DVW*MUL>Q9_6`W#,2ST:17"'W'YF2?)NH%5V"_F +M7;[0VI^.\JJ-T,_(\\5#ZX1HVQJ7KU0UCF#FGD-?NRMKA;X<,[/[*94^27X, +M#)I<:BO^_-I%B&A1U>S)9__""\/M>Q5AIY'*]EPTNJW+.J57[$X\U:;W">Z; +M8P\Z0[ZQOI*B*?BJ?B5+(/Z4.4AJ@;()1YUV4+XY#!76WZV]LZ+;GZ_Q#LLP +MP`7??+NV**I(A-9N^7HX\V!+YJ3%;R%MD?Q5&H@ +M>$VAME3"U$312+@SF+8F2RR0)T"DG^4N,^P46&+TZKQ7KS`4@-:J%_["UP"( +MK=]N^!UJUO2#6Q*`-`-)^?\/`;^4(@FVLVJ?!D,:O)A6@!TNA%.U^"0-?9H< +M:0&(UWV=+&[82L>'L4XYO20"@)^I']_<2C]D;_,]/)_1?N1+M@PTDL;'[J1L=5\,-?J5Q`$3>_9<2< +MS^)#MZ*AE=5@5[O(<]*(EIA62$U`5B18?#W;BB.*0A3O%[(IVC3ME2PY5F>9$/U'$VW1-BZ +` +end diff --git a/libarchive/test/test_read_format_rar_encryption.c b/libarchive/test/test_read_format_rar_encryption.c new file mode 100644 index 000000000000..a184b86b5ffe --- /dev/null +++ b/libarchive/test/test_read_format_rar_encryption.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2003-2018 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" + +/* + * All of the archives for this teset contain four files: a.txt, b.txt, c.txt, and d.txt + * For solid archives or archvies or archives where filenames are encrypted, all four files are encrypted with the + * password "password". For non-solid archives without filename encryption, a.txt and c.txt are not encrypted, b.txt is + * encrypted with the password "password", and d.txt is encrypted with the password "password2". + * + * For all files the file contents is "This is from " (i.e. "This is from a.txt" etc.) + */ +static void test_encrypted_rar_archive(const char *filename, int filenamesEncrypted, int solid) +{ + struct archive_entry *ae; + struct archive *a; + char buff[128]; + int expected_read_header_result, expected_read_data_result; + const int expected_file_size = 18; /* This is from X.txt */ + + /* We should only ever fail to read the header when filenames are encrypted. Otherwise we're failing for other + * unsupported reasons, in which case we have no hope of detecting encryption */ + expected_read_header_result = filenamesEncrypted ? ARCHIVE_FATAL : ARCHIVE_OK; + + /* We should only ever fail to read the data for "a.txt" and "c.txt" if they are encrypted */ + /* NOTE: We'll never attempt this when filenames are encrypted, so we only check for solid here */ + expected_read_data_result = solid ? ARCHIVE_FATAL : expected_file_size; + + extract_reference_file(filename); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, filename, 10240)); + + /* No data read yet; encryption unknown */ + assertEqualInt(ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Read the header for "a.txt" */ + assertEqualIntA(a, expected_read_header_result, archive_read_next_header(a, &ae)); + if (!filenamesEncrypted) { + assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae)); + assertEqualString("a.txt", archive_entry_pathname(ae)); + assertEqualInt(expected_file_size, archive_entry_size(ae)); + assertEqualInt(solid, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + /* NOTE: The reader will set this value to zero on the first header that it reads, even if later entries + * are encrypted */ + assertEqualInt(solid, archive_read_has_encrypted_entries(a)); + assertEqualIntA(a, expected_read_data_result, archive_read_data(a, buff, sizeof(buff))); + if (!solid) { + assertEqualMem("This is from a.txt", buff, expected_file_size); + } + } + else { + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(1, archive_entry_is_metadata_encrypted(ae)); + assertEqualInt(1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + /* Additional attempts to read headers are futile */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + return; + } + + /* From here on out, we can assume that !filenamesEncrypted */ + + /* Read the header for "b.txt" */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae)); + assertEqualString("b.txt", archive_entry_pathname(ae)); + assertEqualInt(expected_file_size, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualInt(1, archive_read_has_encrypted_entries(a)); + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + /* Read the header for "c.txt" */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae)); + assertEqualString("c.txt", archive_entry_pathname(ae)); + assertEqualInt(expected_file_size, archive_entry_size(ae)); + assertEqualInt(solid, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + /* After setting to true above, this should forever be true */ + assertEqualInt(1, archive_read_has_encrypted_entries(a)); + assertEqualIntA(a, expected_read_data_result, archive_read_data(a, buff, sizeof(buff))); + if (!solid) { + assertEqualMem("This is from c.txt", buff, expected_file_size); + } + + /* Read the header for "d.txt" */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae)); + assertEqualString("d.txt", archive_entry_pathname(ae)); + assertEqualInt(expected_file_size, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualInt(1, archive_read_has_encrypted_entries(a)); + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + +DEFINE_TEST(test_read_format_rar4_encrypted) +{ + test_encrypted_rar_archive("test_read_format_rar4_encrypted.rar", 0, 0); +} + +DEFINE_TEST(test_read_format_rar4_encrypted_filenames) +{ + test_encrypted_rar_archive("test_read_format_rar4_encrypted_filenames.rar", 1, 0); +} + +DEFINE_TEST(test_read_format_rar4_solid_encrypted) +{ + /* TODO: If solid RAR4 support is ever added, the following should pass */ +#if 0 + test_encrypted_rar_archive("test_read_format_rar4_solid_encrypted.rar", 0, 1); +#else + skipping("RAR4 solid archive support not currently available"); +#endif +} + +DEFINE_TEST(test_read_format_rar4_solid_encrypted_filenames) +{ + test_encrypted_rar_archive("test_read_format_rar4_solid_encrypted_filenames.rar", 1, 1); +} + +DEFINE_TEST(test_read_format_rar5_encrypted) +{ + test_encrypted_rar_archive("test_read_format_rar5_encrypted.rar", 0, 0); +} + +DEFINE_TEST(test_read_format_rar5_encrypted_filenames) +{ + test_encrypted_rar_archive("test_read_format_rar5_encrypted_filenames.rar", 1, 0); +} + +DEFINE_TEST(test_read_format_rar5_solid_encrypted) +{ + test_encrypted_rar_archive("test_read_format_rar5_solid_encrypted.rar", 0, 1); +} + +DEFINE_TEST(test_read_format_rar5_solid_encrypted_filenames) +{ + test_encrypted_rar_archive("test_read_format_rar5_solid_encrypted_filenames.rar", 1, 1); +} diff --git a/libarchive/test/test_read_format_xar.c b/libarchive/test/test_read_format_xar.c index 41cbd7dab96f..5c306e58522e 100644 --- a/libarchive/test/test_read_format_xar.c +++ b/libarchive/test/test_read_format_xar.c @@ -620,7 +620,7 @@ has the corresponding timestamps unset. archive_write_set_format_xar(a); archive_write_add_filter_none(a); size_t used, buffsize = 1500; - char *buff = (char*) malloc(buffsize); + char *buff = malloc(buffsize); archive_write_open_memory(a, buff, buffsize, &used); struct archive_entry *ae = archive_entry_new(); @@ -827,7 +827,7 @@ static void verifyB(unsigned char *d, size_t s) { assertA(0 == archive_read_next_header(a, &entry)); buf_size = (size_t) archive_entry_size(entry); assertA(buf_size == 12); - buf = (unsigned char*) malloc(buf_size); + buf = malloc(buf_size); assertA(NULL != buf); assertA(buf_size == (size_t) archive_read_data(a, buf, buf_size)); free(buf); @@ -836,7 +836,7 @@ static void verifyB(unsigned char *d, size_t s) { assertA(0 == archive_read_next_header(a, &entry)); buf_size = (size_t) archive_entry_size(entry); assertA(buf_size == 12); - buf = (unsigned char*) malloc(buf_size); + buf = malloc(buf_size); assertA(NULL != buf); assertA(buf_size == (size_t) archive_read_data(a, buf, buf_size)); free(buf); diff --git a/libarchive/test/test_read_format_zip_nested.c b/libarchive/test/test_read_format_zip_nested.c index 95945638b074..b32e4bb94211 100644 --- a/libarchive/test/test_read_format_zip_nested.c +++ b/libarchive/test/test_read_format_zip_nested.c @@ -49,7 +49,7 @@ DEFINE_TEST(test_read_format_zip_nested) /* Save contents of inner Zip. */ innerLength = (size_t)archive_entry_size(ae); - inner = calloc(innerLength, sizeof(char)); + inner = calloc(innerLength, sizeof(*inner)); assertEqualInt(innerLength, archive_read_data(a, inner, innerLength)); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_truncated_filter.c b/libarchive/test/test_read_truncated_filter.c index 9c5348d935d2..fc8ddf51b73b 100644 --- a/libarchive/test/test_read_truncated_filter.c +++ b/libarchive/test/test_read_truncated_filter.c @@ -43,12 +43,12 @@ test_truncation(const char *compression, int i, r, use_prog; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_sparse_basic.c b/libarchive/test/test_sparse_basic.c index 0350df1e9f27..963d5e8beeaf 100644 --- a/libarchive/test/test_sparse_basic.c +++ b/libarchive/test/test_sparse_basic.c @@ -67,13 +67,16 @@ struct sparse { static void create_sparse_file(const char *, const struct sparse *); -#if defined(__APPLE__) -/* On APFS holes need to be at least 4096x4097 bytes */ -#define MIN_HOLE 16781312 -#else -/* Elsewhere we work with 4096*10 bytes */ -#define MIN_HOLE 409600 -#endif +/* This should be large enough that any OS/filesystem that + * does support sparse files is certain to store a gap this big + * as a hole. */ +/* A few data points: + * = ZFS on FreeBSD needs this to be at least 200kB + * = macOS APFS needs this to be at least 4096x4097 bytes + * + * 32MiB here is bigger than either of the above. + */ +#define MIN_HOLE (32 * 1024UL * 1024UL) #if defined(_WIN32) && !defined(__CYGWIN__) #include diff --git a/libarchive/test/test_tar_large.c b/libarchive/test/test_tar_large.c index 7ff3fee17717..c1f379162ad7 100644 --- a/libarchive/test/test_tar_large.c +++ b/libarchive/test/test_tar_large.c @@ -99,7 +99,7 @@ memory_write(struct archive *a, void *_private, const void *buff, size_t size) } else { /* Yes, we're assuming the very first write is metadata. */ /* It's header or metadata, copy and save it. */ - block = (struct memblock *)malloc(sizeof(*block)); + block = malloc(sizeof(*block)); memset(block, 0, sizeof(*block)); block->size = size; block->buff = malloc(size); diff --git a/libarchive/test/test_write_disk_secure_noabsolutepaths.c b/libarchive/test/test_write_disk_secure_noabsolutepaths.c new file mode 100644 index 000000000000..df244727fe44 --- /dev/null +++ b/libarchive/test/test_write_disk_secure_noabsolutepaths.c @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Mostyn Bramley-Moore + */ + +#include "test.h" + +#include + +#if defined(_WIN32) && !defined(__CYGWIN__) +#define UNLINK _unlink +#else +#include +#define UNLINK unlink +#endif + +/* + * Exercise security checks that should prevent writing absolute paths + * when extracting archives. + */ +DEFINE_TEST(test_write_disk_secure_noabsolutepaths) +{ + struct archive *a, *ad; + struct archive_entry *ae; + + char buff[10000]; + + size_t used; + + // Create an archive_write object. + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); + + // Create an absolute path for a test file inside testworkdir. + char *entry_suffix = "/badfile"; + size_t entry_suffix_length = strlen(entry_suffix); + size_t testworkdir_length = strlen(testworkdir); + size_t temp_absolute_file_name_length = testworkdir_length + entry_suffix_length; + char *temp_absolute_file_name = calloc(1, temp_absolute_file_name_length + 1); // +1 for null character. + assertEqualInt(snprintf(temp_absolute_file_name, temp_absolute_file_name_length + 1, "%s%s", testworkdir, entry_suffix), + temp_absolute_file_name_length); + + // Convert to a unix-style path, so we can compare it to the entry + // path when reading back the archive. + for (char *p = temp_absolute_file_name; *p != '\0'; p++) + if (*p == '\\') *p = '/'; + + // Add a regular file entry with an absolute path. + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, temp_absolute_file_name); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_entry_set_size(ae, 6); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(6, archive_write_data(a, "hello", 6)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + // Now try to extract the data. + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(temp_absolute_file_name, archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(AE_IFREG | 0777, archive_entry_mode(ae)); + assertEqualInt(6, archive_entry_size(ae)); + + // This should succeed. + assertEqualInt(ARCHIVE_OK, archive_read_extract(a, ae, 0)); + UNLINK(temp_absolute_file_name); + + // This should fail, since the archive entry has an absolute path. + assert(ARCHIVE_OK != archive_read_extract(a, ae, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS)); + + // This should also fail. + assert((ad = archive_write_new()) != NULL); + assertEqualInt(ARCHIVE_OK, archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS)); + assert(ARCHIVE_OK != archive_read_extract2(a, ae, ad)); + + assertEqualInt(ARCHIVE_OK, archive_write_free(ad)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_write_filter_b64encode.c b/libarchive/test/test_write_filter_b64encode.c index e33ff8a9817c..d7c4763b1cdc 100644 --- a/libarchive/test/test_write_filter_b64encode.c +++ b/libarchive/test/test_write_filter_b64encode.c @@ -41,10 +41,10 @@ DEFINE_TEST(test_write_filter_b64encode) int i; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); memset(data, 0, datasize); /* diff --git a/libarchive/test/test_write_filter_bzip2.c b/libarchive/test/test_write_filter_bzip2.c index f48bcc213231..20ca0d9a7b22 100644 --- a/libarchive/test/test_write_filter_bzip2.c +++ b/libarchive/test/test_write_filter_bzip2.c @@ -43,12 +43,12 @@ DEFINE_TEST(test_write_filter_bzip2) int i, r, use_prog; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_write_filter_compress.c b/libarchive/test/test_write_filter_compress.c index f7b9565b7db2..6a0c022c48e1 100644 --- a/libarchive/test/test_write_filter_compress.c +++ b/libarchive/test/test_write_filter_compress.c @@ -43,10 +43,10 @@ DEFINE_TEST(test_write_filter_compress) int i; buffsize = 1000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); memset(data, 0, datasize); assert((a = archive_write_new()) != NULL); diff --git a/libarchive/test/test_write_filter_gzip.c b/libarchive/test/test_write_filter_gzip.c index ae81a4fc59d6..14b14ecdd105 100644 --- a/libarchive/test/test_write_filter_gzip.c +++ b/libarchive/test/test_write_filter_gzip.c @@ -44,12 +44,12 @@ DEFINE_TEST(test_write_filter_gzip) int i, r, use_prog = 0; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_write_filter_gzip_timestamp.c b/libarchive/test/test_write_filter_gzip_timestamp.c index ee29f034231c..a148f818dcec 100644 --- a/libarchive/test/test_write_filter_gzip_timestamp.c +++ b/libarchive/test/test_write_filter_gzip_timestamp.c @@ -37,12 +37,12 @@ DEFINE_TEST(test_write_filter_gzip_timestamp) int r, use_prog = 0; buffsize = 10000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_write_filter_lrzip.c b/libarchive/test/test_write_filter_lrzip.c index 2efc2ec284a4..8da7ae39af5d 100644 --- a/libarchive/test/test_write_filter_lrzip.c +++ b/libarchive/test/test_write_filter_lrzip.c @@ -46,10 +46,10 @@ DEFINE_TEST(test_write_filter_lrzip) } buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); memset(data, 0, datasize); /* diff --git a/libarchive/test/test_write_filter_lz4.c b/libarchive/test/test_write_filter_lz4.c index 97a80321dede..74a910b53530 100644 --- a/libarchive/test/test_write_filter_lz4.c +++ b/libarchive/test/test_write_filter_lz4.c @@ -58,10 +58,10 @@ DEFINE_TEST(test_write_filter_lz4) assertEqualInt(ARCHIVE_OK, archive_write_free(a)); buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); datasize = 10000; - assert(NULL != (data = (char *)calloc(datasize, 1))); + assert(NULL != (data = calloc(datasize, 1))); filecount = 10; /* @@ -302,10 +302,10 @@ test_options(const char *options) assertEqualInt(ARCHIVE_OK, archive_write_free(a)); buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); datasize = 10000; - assert(NULL != (data = (char *)calloc(datasize, 1))); + assert(NULL != (data = calloc(datasize, 1))); filecount = 10; /* diff --git a/libarchive/test/test_write_filter_lzip.c b/libarchive/test/test_write_filter_lzip.c index 8d6544668980..631fd96bd5ce 100644 --- a/libarchive/test/test_write_filter_lzip.c +++ b/libarchive/test/test_write_filter_lzip.c @@ -43,12 +43,12 @@ DEFINE_TEST(test_write_filter_lzip) int i, r; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_write_filter_lzma.c b/libarchive/test/test_write_filter_lzma.c index d7c0c5b21b6b..9bb2d8eb7943 100644 --- a/libarchive/test/test_write_filter_lzma.c +++ b/libarchive/test/test_write_filter_lzma.c @@ -42,12 +42,12 @@ DEFINE_TEST(test_write_filter_lzma) int i, r; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_write_filter_lzop.c b/libarchive/test/test_write_filter_lzop.c index 87843f49bd3b..8b74d224dced 100644 --- a/libarchive/test/test_write_filter_lzop.c +++ b/libarchive/test/test_write_filter_lzop.c @@ -52,10 +52,10 @@ DEFINE_TEST(test_write_filter_lzop) } buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); datasize = 10000; - assert(NULL != (data = (char *)calloc(datasize, 1))); + assert(NULL != (data = calloc(datasize, 1))); filecount = 10; /* diff --git a/libarchive/test/test_write_filter_uuencode.c b/libarchive/test/test_write_filter_uuencode.c index 7eda278b35cd..fbd0520880fe 100644 --- a/libarchive/test/test_write_filter_uuencode.c +++ b/libarchive/test/test_write_filter_uuencode.c @@ -41,10 +41,10 @@ DEFINE_TEST(test_write_filter_uuencode) int i; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); memset(data, 0, datasize); /* diff --git a/libarchive/test/test_write_filter_xz.c b/libarchive/test/test_write_filter_xz.c index db4e5dafa274..6baa0473b8e2 100644 --- a/libarchive/test/test_write_filter_xz.c +++ b/libarchive/test/test_write_filter_xz.c @@ -43,12 +43,12 @@ DEFINE_TEST(test_write_filter_xz) int i, r; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_write_filter_zstd.c b/libarchive/test/test_write_filter_zstd.c index 07fbaa8ea633..41451ca86251 100644 --- a/libarchive/test/test_write_filter_zstd.c +++ b/libarchive/test/test_write_filter_zstd.c @@ -37,12 +37,12 @@ DEFINE_TEST(test_write_filter_zstd) int i, r; buffsize = 2000000; - assert(NULL != (buff = (char *)malloc(buffsize))); + assert(NULL != (buff = malloc(buffsize))); if (buff == NULL) return; datasize = 10000; - assert(NULL != (data = (char *)malloc(datasize))); + assert(NULL != (data = malloc(datasize))); if (data == NULL) { free(buff); return; diff --git a/libarchive/test/test_write_format_iso9660_filename.c b/libarchive/test/test_write_format_iso9660_filename.c index 713883bdc8cb..ca617c3a94d8 100644 --- a/libarchive/test/test_write_format_iso9660_filename.c +++ b/libarchive/test/test_write_format_iso9660_filename.c @@ -321,7 +321,7 @@ DEFINE_TEST(test_write_format_iso9660_filename) */ fcnt = create_iso_image(buff, buffsize, &used, NULL); - fns.names = (char **)malloc(sizeof(char *) * fcnt); + fns.names = malloc(sizeof(char *) * fcnt); assert(fns.names != NULL); if (fns.names == NULL) { free(buff); diff --git a/libarchive/test/test_write_format_zip_large.c b/libarchive/test/test_write_format_zip_large.c index 90bd16aaa581..d08dae46d807 100644 --- a/libarchive/test/test_write_format_zip_large.c +++ b/libarchive/test/test_write_format_zip_large.c @@ -96,7 +96,7 @@ memory_write(struct archive *a, void *_private, const void *buff, size_t size) } else { /* Yes, we're assuming the very first write is metadata. */ /* It's header or metadata, copy and save it. */ - block = (struct fileblock *)malloc(sizeof(*block)); + block = malloc(sizeof(*block)); memset(block, 0, sizeof(*block)); block->size = (int)size; block->buff = malloc(size); diff --git a/libarchive/test/test_write_format_zip_stream.c b/libarchive/test/test_write_format_zip_stream.c index 6619aa7f35fb..78bda6c27702 100644 --- a/libarchive/test/test_write_format_zip_stream.c +++ b/libarchive/test/test_write_format_zip_stream.c @@ -71,7 +71,11 @@ DEFINE_TEST(test_write_format_zip_stream) unsigned long crc; unsigned long compressed_size = 0; int file_perm = 00644; +#ifdef HAVE_ZLIB_H int zip_version = 20; +#else + int zip_version = 10; +#endif int zip_compression = 8; short file_uid = 10, file_gid = 20; unsigned char *buff, *buffend, *p; diff --git a/tar/CMakeLists.txt b/tar/CMakeLists.txt index 6434791f788f..a5b83454a387 100644 --- a/tar/CMakeLists.txt +++ b/tar/CMakeLists.txt @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# ############################################ # # How to build bsdtar diff --git a/tar/bsdtar.1 b/tar/bsdtar.1 index fe9ec9504674..7a7b0d5d9fb1 100644 --- a/tar/bsdtar.1 +++ b/tar/bsdtar.1 @@ -1,28 +1,10 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2003-2007 Tim Kientzle .\" Copyright (c) 2017 Martin Matuska .\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" .Dd April 23, 2024 .Dt TAR 1 .Os diff --git a/tar/bsdtar.c b/tar/bsdtar.c index f0e71afd1ca7..439093ded76a 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bsdtar_platform.h" diff --git a/tar/bsdtar.h b/tar/bsdtar.h index 22056c7920c4..42520c88f2bc 100644 --- a/tar/bsdtar.h +++ b/tar/bsdtar.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef BSDTAR_H_INCLUDED diff --git a/tar/bsdtar_platform.h b/tar/bsdtar_platform.h index a4f37d95e9b3..02f64dcd7a04 100644 --- a/tar/bsdtar_platform.h +++ b/tar/bsdtar_platform.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @@ -115,7 +97,7 @@ #define __LA_NORETURN __attribute__((__noreturn__)) #elif defined(_MSC_VER) #define __LA_NORETURN __declspec(noreturn) -#else +#else #define __LA_NORETURN #endif diff --git a/tar/bsdtar_windows.c b/tar/bsdtar_windows.c index b40fea776d2e..a63f27e50532 100644 --- a/tar/bsdtar_windows.c +++ b/tar/bsdtar_windows.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2009 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if defined(_WIN32) && !defined(__CYGWIN__) diff --git a/tar/bsdtar_windows.h b/tar/bsdtar_windows.h index 7ca649c2587e..915b22ef99fb 100644 --- a/tar/bsdtar_windows.h +++ b/tar/bsdtar_windows.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2009 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef BSDTAR_WINDOWS_H diff --git a/tar/cmdline.c b/tar/cmdline.c index 2a89f42b0880..35cb1cb43bf1 100644 --- a/tar/cmdline.c +++ b/tar/cmdline.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* diff --git a/tar/config_freebsd.h b/tar/config_freebsd.h index 761f71cfbeca..32f033059c2b 100644 --- a/tar/config_freebsd.h +++ b/tar/config_freebsd.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* A default configuration for FreeBSD, used if there is no config.h. */ diff --git a/tar/creation_set.c b/tar/creation_set.c index 5cd1232b764c..6883090418b0 100644 --- a/tar/creation_set.c +++ b/tar/creation_set.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bsdtar_platform.h" @@ -134,7 +116,7 @@ _cset_add_filter(struct creation_set *cset, int program, const char *filter) struct filter_set *new_ptr; char *new_filter; - new_ptr = (struct filter_set *)realloc(cset->filters, + new_ptr = realloc(cset->filters, sizeof(*cset->filters) * (cset->filter_count + 1)); if (new_ptr == NULL) lafe_errc(1, 0, "No memory"); diff --git a/tar/read.c b/tar/read.c index a7f14a07bb35..8563fe714f9a 100644 --- a/tar/read.c +++ b/tar/read.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bsdtar_platform.h" diff --git a/tar/subst.c b/tar/subst.c index 9747abb906c4..0194cc84bd2d 100644 --- a/tar/subst.c +++ b/tar/subst.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2008 Joerg Sonnenberger * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bsdtar_platform.h" diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt index 7808a8d1f2ba..8d0ba4ad3e28 100644 --- a/tar/test/CMakeLists.txt +++ b/tar/test/CMakeLists.txt @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# ############################################ # # How to build bsdtar_test @@ -32,6 +35,7 @@ IF(ENABLE_TAR AND ENABLE_TEST) test_option_H_upper.c test_option_L_upper.c test_option_O_upper.c + test_option_P.c test_option_T_upper.c test_option_U_upper.c test_option_X_upper.c diff --git a/tar/test/test.h b/tar/test/test.h index 549357b4e0fd..823ec0824f8c 100644 --- a/tar/test/test.h +++ b/tar/test/test.h @@ -1,26 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2017 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Every test program should #include "test.h" as the first thing. */ diff --git a/tar/test/test_0.c b/tar/test/test_0.c index 7a3c2e46858f..9c25056255e1 100644 --- a/tar/test/test_0.c +++ b/tar/test/test_0.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_basic.c b/tar/test/test_basic.c index a59236c92b55..a74ed0a13591 100644 --- a/tar/test/test_basic.c +++ b/tar/test/test_basic.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_copy.c b/tar/test/test_copy.c index 27faaecbad6c..d1263dc7928f 100644 --- a/tar/test/test_copy.c +++ b/tar/test/test_copy.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_empty_mtree.c b/tar/test/test_empty_mtree.c index 11cdfb56690a..9ef098fe4e47 100644 --- a/tar/test/test_empty_mtree.c +++ b/tar/test/test_empty_mtree.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_Z.c b/tar/test/test_extract_tar_Z.c index b03aca6d1da5..cd195560ceb0 100644 --- a/tar/test/test_extract_tar_Z.c +++ b/tar/test/test_extract_tar_Z.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_bz2.c b/tar/test/test_extract_tar_bz2.c index 02b3ee326d5b..3c30c5ac4bb0 100644 --- a/tar/test/test_extract_tar_bz2.c +++ b/tar/test/test_extract_tar_bz2.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_grz.c b/tar/test/test_extract_tar_grz.c index f0adf994dec6..f0eb0017191b 100644 --- a/tar/test/test_extract_tar_grz.c +++ b/tar/test/test_extract_tar_grz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_gz.c b/tar/test/test_extract_tar_gz.c index b17d66f01529..b0e69da7b57e 100644 --- a/tar/test/test_extract_tar_gz.c +++ b/tar/test/test_extract_tar_gz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_lrz.c b/tar/test/test_extract_tar_lrz.c index d6049809bb22..8b63f7de448b 100644 --- a/tar/test/test_extract_tar_lrz.c +++ b/tar/test/test_extract_tar_lrz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_lz.c b/tar/test/test_extract_tar_lz.c index 3889138928d1..221cc46855d5 100644 --- a/tar/test/test_extract_tar_lz.c +++ b/tar/test/test_extract_tar_lz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_lz4.c b/tar/test/test_extract_tar_lz4.c index f0e03ed3206e..eef2275b7313 100644 --- a/tar/test/test_extract_tar_lz4.c +++ b/tar/test/test_extract_tar_lz4.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012,2014 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_lzma.c b/tar/test/test_extract_tar_lzma.c index fd9f547fb524..68b9e4918316 100644 --- a/tar/test/test_extract_tar_lzma.c +++ b/tar/test/test_extract_tar_lzma.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_lzo.c b/tar/test/test_extract_tar_lzo.c index 9c05e15a6b04..22566a290b7c 100644 --- a/tar/test/test_extract_tar_lzo.c +++ b/tar/test/test_extract_tar_lzo.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_xz.c b/tar/test/test_extract_tar_xz.c index 8684072d76f5..f9cd18d1e2ad 100644 --- a/tar/test/test_extract_tar_xz.c +++ b/tar/test/test_extract_tar_xz.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_extract_tar_zstd.c b/tar/test/test_extract_tar_zstd.c index 1eced8817387..a2e8d43928e2 100644 --- a/tar/test/test_extract_tar_zstd.c +++ b/tar/test/test_extract_tar_zstd.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Sean Purcell * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_format_newc.c b/tar/test/test_format_newc.c index 5357cc7cdae4..ec84b75b7f19 100644 --- a/tar/test/test_format_newc.c +++ b/tar/test/test_format_newc.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_help.c b/tar/test/test_help.c index fd97a217b789..51575bbfe287 100644 --- a/tar/test/test_help.c +++ b/tar/test/test_help.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_leading_slash.c b/tar/test/test_leading_slash.c index ca64ad154055..7aab992c842c 100644 --- a/tar/test/test_leading_slash.c +++ b/tar/test/test_leading_slash.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2014 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_missing_file.c b/tar/test/test_missing_file.c index 1cc40f3745e8..7c0557268dfc 100644 --- a/tar/test/test_missing_file.c +++ b/tar/test/test_missing_file.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2016 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_C_mtree.c b/tar/test/test_option_C_mtree.c index 25679644af61..b6ab159941d8 100644 --- a/tar/test/test_option_C_mtree.c +++ b/tar/test/test_option_C_mtree.c @@ -1,29 +1,11 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018 The FreeBSD Foundation * All rights reserved. - * + * * This software was developed by Arshan Khanifar * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" @@ -39,12 +21,12 @@ DEFINE_TEST(test_option_C_mtree) char *p; #endif - /* an absolute path to mtree file */ - char *mtree_file = "/METALOG.mtree"; + /* an absolute path to mtree file */ + char *mtree_file = "/METALOG.mtree"; char *absolute_path = malloc(strlen(testworkdir) + strlen(mtree_file) + 1); strcpy(absolute_path, testworkdir); strcat(absolute_path, mtree_file ); - + /* Create an archive using an mtree file. */ assertMakeFile(absolute_path, 0777, content); assertMakeDir("bar", 0775); diff --git a/tar/test/test_option_C_upper.c b/tar/test/test_option_C_upper.c index cadc924e1d47..a4eb82a153f2 100644 --- a/tar/test/test_option_C_upper.c +++ b/tar/test/test_option_C_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_H_upper.c b/tar/test/test_option_H_upper.c index 3f999d38e809..ac4993bdef06 100644 --- a/tar/test/test_option_H_upper.c +++ b/tar/test/test_option_H_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_L_upper.c b/tar/test/test_option_L_upper.c index 60cffe49f9d4..919c15c6f376 100644 --- a/tar/test/test_option_L_upper.c +++ b/tar/test/test_option_L_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_O_upper.c b/tar/test/test_option_O_upper.c index a5540dbe8417..f70d7e3b4413 100644 --- a/tar/test/test_option_O_upper.c +++ b/tar/test/test_option_O_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_P.c b/tar/test/test_option_P.c new file mode 100644 index 000000000000..e63da3e0875c --- /dev/null +++ b/tar/test/test_option_P.c @@ -0,0 +1,82 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Mostyn Bramley-Moore + */ + +#include "test.h" + +#include +#include + +#if defined(_WIN32) && !defined(__CYGWIN__) +#define UNLINK _unlink +#else +#define UNLINK unlink +#endif + +DEFINE_TEST(test_extract_tar_absolute_paths) +{ + int r; + + // Create an absolute path for a test file inside testworkdir. + char *entry_suffix = "/tar-noabs"; + size_t entry_suffix_length = strlen(entry_suffix); + size_t testworkdir_length = strlen(testworkdir); + size_t temp_absolute_file_name_length = testworkdir_length + entry_suffix_length; + char *temp_absolute_file_name = calloc(1, temp_absolute_file_name_length + 1); // +1 for null character. + assertEqualInt(snprintf(temp_absolute_file_name, temp_absolute_file_name_length + 1, "%s%s", testworkdir, entry_suffix), + temp_absolute_file_name_length); + +#if defined(_WIN32) && !defined(__CYGWIN__) + // I'm unsure how to specify paths with spaces for the test invocation on windows. + // Adding quotes doesn't seem to work. We should find a way to escape these paths, + // but for now let's fail in a place that's obviously related to the test setup if + // testworkdir contains spaces. + for (char *p = temp_absolute_file_name; *p != '\0'; p++) + { + assert(*p != ' '); + if (*p == ' ') break; + } +#endif + + // Create the file. + const char *sample_data = "test file from test_extract_tar_absolute_paths"; + assertMakeFile(temp_absolute_file_name, 0644, sample_data); + + // Create an archive with the test file, using an absolute path. +#if defined(_WIN32) && !defined(__CYGWIN__) + r = systemf("%s --absolute-paths -cf test.tar %s", testprog, temp_absolute_file_name); +#else + r = systemf("%s --absolute-paths -cf test.tar \"%s\"", testprog, temp_absolute_file_name); +#endif + assertEqualInt(r, 0); + + UNLINK(temp_absolute_file_name); + + // Extracting the archive without -P / --absolute-paths should strip leading drive letter or slash + r = systemf("%s -xf test.tar", testprog); + assertEqualInt(r, 0); + assertFileNotExists(temp_absolute_file_name); + + // Check that the mangled path exists. +#if defined(_WIN32) && !defined(__CYGWIN__) + assertFileExists(temp_absolute_file_name + 3); // Skip the drive letter, colon and slash. + UNLINK(temp_absolute_file_name + 3); +#else + assertFileExists(temp_absolute_file_name + 1); // Skip the slash. + UNLINK(temp_absolute_file_name + 1); +#endif + + // Extracting the archive with -P / --absolute-paths should create the file. + r = systemf("%s --absolute-paths -xf test.tar", testprog); + assertEqualInt(r, 0); + assertFileExists(temp_absolute_file_name); + + // Check that the mangled path wasn't created. +#if defined(_WIN32) && !defined(__CYGWIN__) + assertFileNotExists(temp_absolute_file_name + 3); // Skip the drive letter, colon and slash. +#else + assertFileNotExists(temp_absolute_file_name + 1); // Skip the slash. +#endif +} diff --git a/tar/test/test_option_T_upper.c b/tar/test/test_option_T_upper.c index c64767fcfb84..e3c5bc2d30cd 100644 --- a/tar/test/test_option_T_upper.c +++ b/tar/test/test_option_T_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_U_upper.c b/tar/test/test_option_U_upper.c index 4518a5f9fd8e..841874b6b196 100644 --- a/tar/test/test_option_U_upper.c +++ b/tar/test/test_option_U_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_X_upper.c b/tar/test/test_option_X_upper.c index b5ea98b9a0d7..a2eac676b2e7 100644 --- a/tar/test/test_option_X_upper.c +++ b/tar/test/test_option_X_upper.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_a.c b/tar/test/test_option_a.c index 52797411c751..0a58fc665c1f 100644 --- a/tar/test/test_option_a.c +++ b/tar/test/test_option_a.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_acls.c b/tar/test/test_option_acls.c index 333ac2e4fb47..5bbe977e5cf2 100644 --- a/tar/test/test_option_acls.c +++ b/tar/test/test_option_acls.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Martin Matuska * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_b.c b/tar/test/test_option_b.c index d7e0f399c297..2b2225de6531 100644 --- a/tar/test/test_option_b.c +++ b/tar/test/test_option_b.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_b64encode.c b/tar/test/test_option_b64encode.c index b9a2b809ea4a..3a083e79b31f 100644 --- a/tar/test/test_option_b64encode.c +++ b/tar/test/test_option_b64encode.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_exclude.c b/tar/test/test_option_exclude.c index b21ec624aec2..9c8d8bec27b9 100644 --- a/tar/test/test_option_exclude.c +++ b/tar/test/test_option_exclude.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_exclude_vcs.c b/tar/test/test_option_exclude_vcs.c index ec4dc5594f5c..ccc19d29d4dd 100644 --- a/tar/test/test_option_exclude_vcs.c +++ b/tar/test/test_option_exclude_vcs.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2019 Martin Matuska * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" @@ -63,7 +45,7 @@ DEFINE_TEST(test_option_exclude_vcs) assertMakeDir("_darcs", 0755); assertMakeFile("_darcs/format", 0644, ""); assertChdir(".."); - + assertEqualInt(0, systemf("%s -c -C in -f included.tar .", testprog)); assertEqualInt(0, systemf("%s -c --exclude-vcs -C in -f excluded.tar .", testprog)); diff --git a/tar/test/test_option_fflags.c b/tar/test/test_option_fflags.c index 045c780edefc..a796f571f49a 100644 --- a/tar/test/test_option_fflags.c +++ b/tar/test/test_option_fflags.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Martin Matuska * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" @@ -97,7 +79,7 @@ DEFINE_TEST(test_option_fflags) assertMakeDir("nofflags_fflags", 0755); clear_fflags("nofflags_fflags"); r = systemf("%s -x -C nofflags_fflags --no-same-permissions --fflags -f nofflags.tar >nofflags_fflags.out 2>nofflags_fflags.err", testprog); - assertEqualInt(r, 0); + assertEqualInt(r, 0); assertUnequalFflags("f", "nofflags_fflags/f"); /* Extract nofflags with nofflags */ diff --git a/tar/test/test_option_gid_gname.c b/tar/test/test_option_gid_gname.c index a4cff1ab2f64..38220772dc12 100644 --- a/tar/test/test_option_gid_gname.c +++ b/tar/test/test_option_gid_gname.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_group.c b/tar/test/test_option_group.c index d429ddab9f9f..8d3cc651362a 100644 --- a/tar/test/test_option_group.c +++ b/tar/test/test_option_group.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2010 Tim Kientzle * Copyright (c) 2024 Haelwenn (lanodan) Monnier * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_grzip.c b/tar/test/test_option_grzip.c index d898e4408151..d63751631a46 100644 --- a/tar/test/test_option_grzip.c +++ b/tar/test/test_option_grzip.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_ignore_zeros.c b/tar/test/test_option_ignore_zeros.c index 985ad3082fce..31e0dd940460 100644 --- a/tar/test/test_option_ignore_zeros.c +++ b/tar/test/test_option_ignore_zeros.c @@ -1,27 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2021 Ryan Libby * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" @@ -89,6 +70,14 @@ DEFINE_TEST(test_option_ignore_zeros_mode_x) DEFINE_TEST(test_option_ignore_zeros_mode_c) { +#if defined(_WIN32) && !defined(__CYGWIN__) + // The first command run by systemf below prints this to stderr: + // bsdtar.exe: a: Can't translate uname '(null)' to UTF-8 + // bsdtar.exe: b: Can't translate uname '(null)' to UTF-8 + skipping("TODO: figure out why this test fails on github workflows with MSVC"); + return; +#endif + if (make_files()) return; diff --git a/tar/test/test_option_j.c b/tar/test/test_option_j.c index cf4d91d0afac..a67ef7412738 100644 --- a/tar/test/test_option_j.c +++ b/tar/test/test_option_j.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_k.c b/tar/test/test_option_k.c index 873a1209b0a9..85bf1c8263ae 100644 --- a/tar/test/test_option_k.c +++ b/tar/test/test_option_k.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_keep_newer_files.c b/tar/test/test_option_keep_newer_files.c index 2572a98c5812..18e1e1152251 100644 --- a/tar/test/test_option_keep_newer_files.c +++ b/tar/test/test_option_keep_newer_files.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_lrzip.c b/tar/test/test_option_lrzip.c index 8bf4633f643e..0ed128586c01 100644 --- a/tar/test/test_option_lrzip.c +++ b/tar/test/test_option_lrzip.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_lz4.c b/tar/test/test_option_lz4.c index 1b766d04969f..6a9a4c3d429b 100644 --- a/tar/test/test_option_lz4.c +++ b/tar/test/test_option_lz4.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_lzma.c b/tar/test/test_option_lzma.c index 1d8697b53ee8..e309a64d2bad 100644 --- a/tar/test/test_option_lzma.c +++ b/tar/test/test_option_lzma.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_lzop.c b/tar/test/test_option_lzop.c index d96a14f08fea..ac9b57c973dd 100644 --- a/tar/test/test_option_lzop.c +++ b/tar/test/test_option_lzop.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_n.c b/tar/test/test_option_n.c index a6bda0599e16..0a20c5a897e8 100644 --- a/tar/test/test_option_n.c +++ b/tar/test/test_option_n.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_newer_than.c b/tar/test/test_option_newer_than.c index a250a4c8d8c6..4486472f1de5 100644 --- a/tar/test/test_option_newer_than.c +++ b/tar/test/test_option_newer_than.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_nodump.c b/tar/test/test_option_nodump.c index 6a5b66e3215a..33768a47f28c 100644 --- a/tar/test/test_option_nodump.c +++ b/tar/test/test_option_nodump.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_older_than.c b/tar/test/test_option_older_than.c index d57c4d414b8f..ffbde8da7cdd 100644 --- a/tar/test/test_option_older_than.c +++ b/tar/test/test_option_older_than.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2010 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_owner.c b/tar/test/test_option_owner.c index 04c86cc0e8d4..ed212031058d 100644 --- a/tar/test/test_option_owner.c +++ b/tar/test/test_option_owner.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2010 Tim Kientzle * Copyright (c) 2024 Haelwenn (lanodan) Monnier * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_passphrase.c b/tar/test/test_option_passphrase.c index 74f3d3d5d031..968a33c00bdb 100644 --- a/tar/test/test_option_passphrase.c +++ b/tar/test/test_option_passphrase.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2014 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_q.c b/tar/test/test_option_q.c index fd4b55e545ae..4bb3ef86b743 100644 --- a/tar/test/test_option_q.c +++ b/tar/test/test_option_q.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_r.c b/tar/test/test_option_r.c index 655b973ad1e2..622512c95f71 100644 --- a/tar/test/test_option_r.c +++ b/tar/test/test_option_r.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_s.c b/tar/test/test_option_s.c index 564793b97d5e..1a36280c111f 100644 --- a/tar/test/test_option_s.c +++ b/tar/test/test_option_s.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_safe_writes.c b/tar/test/test_option_safe_writes.c index d1e36cfd4736..b88479bc5f35 100644 --- a/tar/test/test_option_safe_writes.c +++ b/tar/test/test_option_safe_writes.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2020 Martin Matuska * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_uid_uname.c b/tar/test/test_option_uid_uname.c index 261e3b86565b..a6f3c5bb979b 100644 --- a/tar/test/test_option_uid_uname.c +++ b/tar/test/test_option_uid_uname.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2010 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_uuencode.c b/tar/test/test_option_uuencode.c index 4bb6e0898c2b..f492764eed6a 100644 --- a/tar/test/test_option_uuencode.c +++ b/tar/test/test_option_uuencode.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_xattrs.c b/tar/test/test_option_xattrs.c index eef6c779bb52..8c711a9ae4b2 100644 --- a/tar/test/test_option_xattrs.c +++ b/tar/test/test_option_xattrs.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Martin Matuska * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" @@ -73,7 +55,7 @@ DEFINE_TEST(test_option_xattrs) /* Extract noxattrs with xattrs */ assertMakeDir("noxattrs_xattrs", 0755); r = systemf("%s -x -C noxattrs_xattrs --no-same-permissions --xattrs -f noxattrs.tar >noxattrs_xattrs.out 2>noxattrs_xattrs.err", testprog); - assertEqualInt(r, 0); + assertEqualInt(r, 0); readval = getXattr("noxattrs_xattrs/f", testattr, &size); assert(readval == NULL); diff --git a/tar/test/test_option_xz.c b/tar/test/test_option_xz.c index 45163e735f19..71043947526d 100644 --- a/tar/test/test_option_xz.c +++ b/tar/test/test_option_xz.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_z.c b/tar/test/test_option_z.c index 8e10e37ba22e..a14380de4262 100644 --- a/tar/test/test_option_z.c +++ b/tar/test/test_option_z.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_option_zstd.c b/tar/test/test_option_zstd.c index f9983670249c..192c20948ec9 100644 --- a/tar/test/test_option_zstd.c +++ b/tar/test/test_option_zstd.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2017 Sean Purcell * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_patterns.c b/tar/test/test_patterns.c index 64f8fffe90f9..7df66904cd95 100644 --- a/tar/test/test_patterns.c +++ b/tar/test/test_patterns.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2009 Michihiro NAKAJIMA * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_print_longpath.c b/tar/test/test_print_longpath.c index a21651fa15eb..c55651e9717e 100644 --- a/tar/test/test_print_longpath.c +++ b/tar/test/test_print_longpath.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2011 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_stdio.c b/tar/test/test_stdio.c index d046727a2dd3..0c27c59a2af6 100644 --- a/tar/test/test_stdio.c +++ b/tar/test/test_stdio.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_strip_components.c b/tar/test/test_strip_components.c index 9bf79ab7cf20..97c90b3b426e 100644 --- a/tar/test/test_strip_components.c +++ b/tar/test/test_strip_components.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_symlink_dir.c b/tar/test/test_symlink_dir.c index 4c5666204388..22a98a19617f 100644 --- a/tar/test/test_symlink_dir.c +++ b/tar/test/test_symlink_dir.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_version.c b/tar/test/test_version.c index 1b896c0c49d1..f46e3442a4b7 100644 --- a/tar/test/test_version.c +++ b/tar/test/test_version.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2017 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/test/test_windows.c b/tar/test/test_windows.c index d619667bfa6c..e4ee5cfb7adb 100644 --- a/tar/test/test_windows.c +++ b/tar/test/test_windows.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2009 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/tar/util.c b/tar/util.c index 85060461cc7f..a152f3506994 100644 --- a/tar/util.c +++ b/tar/util.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bsdtar_platform.h" diff --git a/tar/write.c b/tar/write.c index 43cd70233397..f1838d6b5dea 100644 --- a/tar/write.c +++ b/tar/write.c @@ -1,27 +1,9 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2012 Michihiro NAKAJIMA * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bsdtar_platform.h" @@ -984,12 +966,11 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, safe_fprintf(stderr, "a "); list_item_verbose(bsdtar, stderr, entry); lafe_warnc(0, ": %s", archive_error_string(a)); - } else if (bsdtar->verbose > 0) { + } else { lafe_warnc(0, "%s: %s", archive_entry_pathname(entry), archive_error_string(a)); - } else - fprintf(stderr, ": %s", archive_error_string(a)); + } } if (e == ARCHIVE_FATAL) diff --git a/test_utils/test_common.h b/test_utils/test_common.h index 8e1ec82436f8..9a20224a2065 100644 --- a/test_utils/test_common.h +++ b/test_utils/test_common.h @@ -48,6 +48,9 @@ #endif #include /* Windows requires this before sys/stat.h */ +#if !HAVE_SUSECONDS_T +#define suseconds_t long +#endif #include #if HAVE_DIRENT_H @@ -313,7 +316,7 @@ int assertion_non_empty_file(const char *, int, const char *); int assertion_set_nodump(const char *, int, const char *); int assertion_text_file_contents(const char *, int, const char *buff, const char *f); int assertion_umask(const char *, int, int); -int assertion_utimes(const char *, int, const char *, long, long, long, long ); +int assertion_utimes(const char *, int, const char *, time_t, suseconds_t, time_t, suseconds_t); int assertion_version(const char*, int, const char *, const char *); void skipping_setup(const char *, int); diff --git a/test_utils/test_main.c b/test_utils/test_main.c index ae5e74225cf2..76fcd79406ff 100644 --- a/test_utils/test_main.c +++ b/test_utils/test_main.c @@ -85,6 +85,10 @@ #include #endif +#ifndef nitems +#define nitems(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + /* * * Windows support routines @@ -236,10 +240,10 @@ my_CreateSymbolicLinkA(const char *linkname, const char *target, if (tlen == 0 || llen == 0) return (0); - tgt = malloc((tlen + 1) * sizeof(char)); + tgt = malloc(tlen + 1); if (tgt == NULL) return (0); - src = malloc((llen + 1) * sizeof(char)); + src = malloc(llen + 1); if (src == NULL) { free(tgt); return (0); @@ -1240,16 +1244,19 @@ assertion_file_contains_lines_any_order(const char *file, int line, } expected_count = i; if (expected_count) { - expected = malloc(sizeof(char *) * expected_count); + expected = calloc(expected_count, sizeof(*expected)); if (expected == NULL) { failure_start(pathname, line, "Can't allocate memory"); failure_finish(NULL); - free(expected); - free(buff); - return (0); + goto cleanup; } for (i = 0; lines[i] != NULL; ++i) { expected[i] = strdup(lines[i]); + if (expected[i] == NULL) { + failure_start(pathname, line, "Can't allocate memory"); + failure_finish(NULL); + goto cleanup; + } } } @@ -1267,9 +1274,7 @@ assertion_file_contains_lines_any_order(const char *file, int line, if (actual == NULL) { failure_start(pathname, line, "Can't allocate memory"); failure_finish(NULL); - free(expected); - free(buff); - return (0); + goto cleanup; } for (j = 0, p = buff; p < buff + buff_size; p += 1 + strlen(p)) { @@ -1282,8 +1287,6 @@ assertion_file_contains_lines_any_order(const char *file, int line, /* Erase matching lines from both lists */ for (i = 0; i < expected_count; ++i) { - if (expected[i] == NULL) - continue; for (j = 0; j < actual_count; ++j) { if (actual[j] == NULL) continue; @@ -1306,9 +1309,9 @@ assertion_file_contains_lines_any_order(const char *file, int line, ++actual_failure; } if (expected_failure == 0 && actual_failure == 0) { - free(buff); - free(expected); free(actual); + free(expected); + free(buff); return (1); } failure_start(file, line, "File doesn't match: %s", pathname); @@ -1316,6 +1319,7 @@ assertion_file_contains_lines_any_order(const char *file, int line, if (expected[i] != NULL) { logprintf(" Expected but not present: %s\n", expected[i]); free(expected[i]); + expected[i] = NULL; } } for (j = 0; j < actual_count; ++j) { @@ -1323,9 +1327,15 @@ assertion_file_contains_lines_any_order(const char *file, int line, logprintf(" Present but not expected: %s\n", actual[j]); } failure_finish(NULL); - free(buff); - free(expected); +cleanup: free(actual); + if (expected != NULL) { + for (i = 0; i < expected_count; ++i) + if (expected[i] != NULL) + free(expected[i]); + free(expected); + } + free(buff); return (0); } @@ -1769,16 +1779,17 @@ is_symlink(const char *file, int line, FILE_FLAG_OPEN_REPARSE_POINT; /* Replace slashes with backslashes in pathname */ - pn = malloc((strlen(pathname) + 1) * sizeof(char)); - p = pathname; - s = pn; - while(*p != '\0') { - if(*p == '/') + pn = malloc(strlen(pathname) + 1); + if (pn == NULL) { + failure_start(file, line, "Can't allocate memory"); + failure_finish(NULL); + return (0); + } + for (p = pathname, s = pn; *p != '\0'; p++, s++) { + if (*p == '/') *s = '\\'; else *s = *p; - p++; - s++; } *s = '\0'; @@ -2086,8 +2097,8 @@ assertion_umask(const char *file, int line, int mask) /* Set times, report failures. */ int -assertion_utimes(const char *file, int line, - const char *pathname, long at, long at_nsec, long mt, long mt_nsec) +assertion_utimes(const char *file, int line, const char *pathname, + time_t at, suseconds_t at_nsec, time_t mt, suseconds_t mt_nsec) { int r; @@ -2953,7 +2964,6 @@ setTestAcl(const char *path) acl_permset_t permset; const uid_t uid = 1; uuid_t uuid; - int i; const acl_perm_t acl_perms[] = { ACL_READ_DATA, ACL_WRITE_DATA, @@ -2995,7 +3005,7 @@ setTestAcl(const char *path) failure("acl_get_permset() error: %s", strerror(errno)); if (assertEqualInt(r, 0) == 0) goto testacl_free; - for (i = 0; i < (int)(sizeof(acl_perms) / sizeof(acl_perms[0])); i++) { + for (size_t i = 0; i < nitems(acl_perms); i++) { r = acl_add_perm(permset, acl_perms[i]); failure("acl_add_perm() error: %s", strerror(errno)); if (assertEqualInt(r, 0) == 0) @@ -3645,7 +3655,7 @@ test_run(int i, const char *tmpdir) static void usage(const char *program) { - static const int limit = sizeof(tests) / sizeof(tests[0]); + static const int limit = nitems(tests); int i; printf("Usage: %s [options] ...\n", program); @@ -3877,10 +3887,11 @@ get_test_set(int *test_set, int limit, const char *test) int main(int argc, char **argv) { - static const int limit = sizeof(tests) / sizeof(tests[0]); - int test_set[sizeof(tests) / sizeof(tests[0])]; + static const int limit = nitems(tests); + int test_set[nitems(tests)]; int i = 0, j = 0, tests_run = 0, tests_failed = 0, option; size_t testprogdir_len; + size_t tmplen; #ifdef PROGRAM size_t tmp2_len; #endif @@ -3925,7 +3936,7 @@ main(int argc, char **argv) */ progname = p = argv[0]; testprogdir_len = strlen(progname) + 1; - if ((testprogdir = (char *)malloc(testprogdir_len)) == NULL) + if ((testprogdir = malloc(testprogdir_len)) == NULL) { fprintf(stderr, "ERROR: Out of memory."); exit(1); @@ -3953,7 +3964,7 @@ main(int argc, char **argv) #endif { /* Fixup path for relative directories. */ - if ((testprogdir = (char *)realloc(testprogdir, + if ((testprogdir = realloc(testprogdir, strlen(pwd) + 1 + strlen(testprogdir) + 1)) == NULL) { fprintf(stderr, "ERROR: Out of memory."); @@ -3980,6 +3991,9 @@ main(int argc, char **argv) tmp = getenv("TEMPDIR"); else tmp = "/tmp"; + tmplen = strlen(tmp); + while (tmplen > 0 && tmp[tmplen - 1] == '/') + tmplen--; /* Allow -d to be controlled through the environment. */ if (getenv(ENVBASE "_DEBUG") != NULL) @@ -4073,7 +4087,7 @@ main(int argc, char **argv) if (testprogfile == NULL) { tmp2_len = strlen(testprogdir) + 1 + strlen(PROGRAM) + 1; - if ((tmp2 = (char *)malloc(tmp2_len)) == NULL) + if ((tmp2 = malloc(tmp2_len)) == NULL) { fprintf(stderr, "ERROR: Out of memory."); exit(1); @@ -4132,16 +4146,16 @@ main(int argc, char **argv) #endif strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp), "%Y-%m-%dT%H.%M.%S", tmptr); - if ((strlen(tmp) + 1 + strlen(progname) + 1 + - strlen(tmpdir_timestamp) + 1 + 3) > - (sizeof(tmpdir) / sizeof(char))) { + if (tmplen + 1 + strlen(progname) + 1 + + strlen(tmpdir_timestamp) + 1 + 3 >= + nitems(tmpdir)) { fprintf(stderr, "ERROR: Temp directory pathname too long\n"); exit(1); } - snprintf(tmpdir, sizeof(tmpdir), "%s/%s.%s-%03d", tmp, - progname, tmpdir_timestamp, i); - if (assertMakeDir(tmpdir,0755)) + snprintf(tmpdir, sizeof(tmpdir), "%.*s/%s.%s-%03d", + (int)tmplen, tmp, progname, tmpdir_timestamp, i); + if (assertMakeDir(tmpdir, 0755)) break; if (i >= 999) { fprintf(stderr, diff --git a/unzip/CMakeLists.txt b/unzip/CMakeLists.txt index 150eb2c6b05d..e9c346897b71 100644 --- a/unzip/CMakeLists.txt +++ b/unzip/CMakeLists.txt @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# ############################################ # # How to build bsdunzip diff --git a/unzip/bsdunzip.1 b/unzip/bsdunzip.1 index a67ca2327066..932f947090f0 100644 --- a/unzip/bsdunzip.1 +++ b/unzip/bsdunzip.1 @@ -1,28 +1,9 @@ .\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2007-2008 Dag-Erling Smørgrav .\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" .Dd June 27, 2023 .Dt BSDUNZIP 1 .Os @@ -215,4 +196,4 @@ double-dash string used to separate options from arguments will need to be repeated. For example, to extract a "-a.jpg" from "-b.zip" with overwrite, one would need to invoke -.Dl bsdunzip -o -- -a.jpg -- -b.zip +.Dl bsdunzip -o -- -a.jpg -- -b.zip diff --git a/unzip/bsdunzip.c b/unzip/bsdunzip.c index 50e08e399558..5058e8798753 100644 --- a/unzip/bsdunzip.c +++ b/unzip/bsdunzip.c @@ -4,34 +4,6 @@ * Copyright (c) 2009, 2010 Joerg Sonnenberger * Copyright (c) 2007-2008 Dag-Erling Smørgrav * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file would be much shorter if we didn't care about command-line - * compatibility with Info-ZIP's UnZip, which requires us to duplicate - * parts of libarchive in order to gain more detailed control of its - * behaviour for the purpose of implementing the -n, -o, -L and -a - * options. */ #include "bsdunzip_platform.h" diff --git a/unzip/bsdunzip.h b/unzip/bsdunzip.h index ab81e3930ec2..e2b7747e4419 100644 --- a/unzip/bsdunzip.h +++ b/unzip/bsdunzip.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023, Martin Matuska * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef BSDUNZIP_H_INCLUDED diff --git a/unzip/bsdunzip_platform.h b/unzip/bsdunzip_platform.h index d4fcbb1aeab4..f00d57981db2 100644 --- a/unzip/bsdunzip_platform.h +++ b/unzip/bsdunzip_platform.h @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @@ -58,7 +40,7 @@ #define __LA_NORETURN __attribute__((__noreturn__)) #elif defined(_MSC_VER) #define __LA_NORETURN __declspec(noreturn) -#else +#else #define __LA_NORETURN #endif diff --git a/unzip/cmdline.c b/unzip/cmdline.c index 4c6efc3e0694..8afddedd5ead 100644 --- a/unzip/cmdline.c +++ b/unzip/cmdline.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* diff --git a/unzip/la_getline.c b/unzip/la_getline.c index 79a6bc010214..40ab35cde842 100644 --- a/unzip/la_getline.c +++ b/unzip/la_getline.c @@ -1,32 +1,10 @@ /* $NetBSD: getline.c,v 1.2 2014/09/16 17:23:50 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. */ #include "bsdunzip_platform.h" diff --git a/unzip/test/test.h b/unzip/test/test.h index 822c3f08133f..03cd03921c9c 100644 --- a/unzip/test/test.h +++ b/unzip/test/test.h @@ -1,26 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2017 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Every test program should #include "test.h" as the first thing. */ diff --git a/unzip/test/test_0.c b/unzip/test/test_0.c index 41279d388b1f..32f757c9b0c6 100644 --- a/unzip/test/test_0.c +++ b/unzip/test/test_0.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_C.c b/unzip/test/test_C.c index fc11b970c2f3..66835c8406f3 100644 --- a/unzip/test/test_C.c +++ b/unzip/test/test_C.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_I.c b/unzip/test/test_I.c index bc70a385911b..2a656012f0a8 100644 --- a/unzip/test/test_I.c +++ b/unzip/test/test_I.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Aaron Lindros * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_L.c b/unzip/test/test_L.c index 4815cb2b139d..5b004d5d5707 100644 --- a/unzip/test/test_L.c +++ b/unzip/test/test_L.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_P_encryption.c b/unzip/test/test_P_encryption.c index 4a7472b4e276..e2cf3cda0ebd 100644 --- a/unzip/test/test_P_encryption.c +++ b/unzip/test/test_P_encryption.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_Z1.c b/unzip/test/test_Z1.c index 58dc750030dd..2a3012b5bf8f 100644 --- a/unzip/test/test_Z1.c +++ b/unzip/test/test_Z1.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_basic.c b/unzip/test/test_basic.c index e997755e7e57..1f37dcd416a3 100644 --- a/unzip/test/test_basic.c +++ b/unzip/test/test_basic.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_d.c b/unzip/test/test_d.c index 01ab9b8caaa3..ea67246207f2 100644 --- a/unzip/test/test_d.c +++ b/unzip/test/test_d.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_doubledash.c b/unzip/test/test_doubledash.c index eb7d34e4f6cc..4467213dbb89 100644 --- a/unzip/test/test_doubledash.c +++ b/unzip/test/test_doubledash.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_glob.c b/unzip/test/test_glob.c index b334ce4bd37d..b53aa16fd85c 100644 --- a/unzip/test/test_glob.c +++ b/unzip/test/test_glob.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_j.c b/unzip/test/test_j.c index a449e02644b5..b87229f42e25 100644 --- a/unzip/test/test_j.c +++ b/unzip/test/test_j.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_n.c b/unzip/test/test_n.c index 992f25ff89fc..bb75c5d7696d 100644 --- a/unzip/test/test_n.c +++ b/unzip/test/test_n.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_not_exist.c b/unzip/test/test_not_exist.c index 9cd6cd5c577a..6b206a74b261 100644 --- a/unzip/test/test_not_exist.c +++ b/unzip/test/test_not_exist.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_o.c b/unzip/test/test_o.c index 33c42b4056f6..64f946774440 100644 --- a/unzip/test/test_o.c +++ b/unzip/test/test_o.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_p.c b/unzip/test/test_p.c index f34a5eae8e13..8bfffbe5dc39 100644 --- a/unzip/test/test_p.c +++ b/unzip/test/test_p.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_q.c b/unzip/test/test_q.c index 9a532c888366..13222a483992 100644 --- a/unzip/test/test_q.c +++ b/unzip/test/test_q.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_singlefile.c b/unzip/test/test_singlefile.c index 70c376eb3932..a72811f046d9 100644 --- a/unzip/test/test_singlefile.c +++ b/unzip/test/test_singlefile.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_t.c b/unzip/test/test_t.c index 40d8d39e54d5..55a516fc636f 100644 --- a/unzip/test/test_t.c +++ b/unzip/test/test_t.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_t_bad.c b/unzip/test/test_t_bad.c index f9afbb40dae2..a9535ca511e9 100644 --- a/unzip/test/test_t_bad.c +++ b/unzip/test/test_t_bad.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_version.c b/unzip/test/test_version.c index efa797982d57..607a4f501363 100644 --- a/unzip/test/test_version.c +++ b/unzip/test/test_version.c @@ -1,26 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2003-2017 Tim Kientzle * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" diff --git a/unzip/test/test_x.c b/unzip/test/test_x.c index d55376849ce9..959beb1950df 100644 --- a/unzip/test/test_x.c +++ b/unzip/test/test_x.c @@ -1,27 +1,8 @@ /* + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2023 Adrian Vovk * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h"