From owner-svn-src-all@freebsd.org Wed Dec 16 22:24:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA9494C81E4; Wed, 16 Dec 2020 22:24:25 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cx8n55hy1z4TWv; Wed, 16 Dec 2020 22:24:25 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B67DE5CAE; Wed, 16 Dec 2020 22:24:25 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0BGMOPA3071570; Wed, 16 Dec 2020 22:24:25 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0BGMOLLR071545; Wed, 16 Dec 2020 22:24:21 GMT (envelope-from mm@FreeBSD.org) Message-Id: <202012162224.0BGMOLLR071545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 16 Dec 2020 22:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368706 - in stable/12: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive lib/libarchive/tests usr.bin/bsd... X-SVN-Group: stable-12 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/12: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive lib/libarchive/tests usr.bin/bsdcat usr.bin/cpio usr.bin/... X-SVN-Commit-Revision: 368706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 22:24:25 -0000 Author: mm Date: Wed Dec 16 22:24:20 2020 New Revision: 368706 URL: https://svnweb.freebsd.org/changeset/base/368706 Log: MFC r368207,368607: MFC r368207: Update libarchive to 3.5.0 Relevant vendor changes: Issue #1258: add archive_read_support_filter_by_code() PR #1347: mtree digest reader support Issue #1381: skip hardlinks pointing to itself on extraction PR #1387: fix writing of cpio archives with hardlinks without file type PR #1388: fix rdev field in cpio format for device nodes PR #1389: completed support for UTF-8 encoding conversion PR #1405: more formats in archive_read_support_format_by_code() PR #1408: fix uninitialized size in rar5_read_data PR #1409: system extended attribute support PR #1435: support for decompression of symbolic links in zipx archives Issue #1456: memory leak after unsuccessful archive_write_open_filename MFC r368607: Sync libarchive with vendor. Vendor changes: Issue #1461: Unbreak build without lzma Issue #1462: warc reader: Fix build with gcc11 Issue #1463: Fix code compatibility in test_archive_read_support.c Issue #1464: Use built-in strnlen on platforms where not available Issue #1465: warc reader: fix undefined behaviour in deconst() function Added: stable/12/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c - copied unchanged from r368234, head/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c stable/12/contrib/libarchive/libarchive/test/test_read_format_zip_7z_lzma.zip.uu - copied unchanged from r368234, head/contrib/libarchive/libarchive/test/test_read_format_zip_7z_lzma.zip.uu Modified: stable/12/contrib/libarchive/COPYING stable/12/contrib/libarchive/NEWS stable/12/contrib/libarchive/libarchive/archive.h stable/12/contrib/libarchive/libarchive/archive_acl.c stable/12/contrib/libarchive/libarchive/archive_check_magic.c stable/12/contrib/libarchive/libarchive/archive_cryptor.c stable/12/contrib/libarchive/libarchive/archive_cryptor_private.h stable/12/contrib/libarchive/libarchive/archive_digest_private.h stable/12/contrib/libarchive/libarchive/archive_entry.c stable/12/contrib/libarchive/libarchive/archive_entry.h stable/12/contrib/libarchive/libarchive/archive_entry_private.h stable/12/contrib/libarchive/libarchive/archive_ppmd7.c stable/12/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c stable/12/contrib/libarchive/libarchive/archive_read_filter.3 stable/12/contrib/libarchive/libarchive/archive_read_set_format.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_by_code.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_cab.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_empty.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_mtree.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_warc.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/12/contrib/libarchive/libarchive/archive_string.c stable/12/contrib/libarchive/libarchive/archive_string.h stable/12/contrib/libarchive/libarchive/archive_util.c stable/12/contrib/libarchive/libarchive/archive_write.c stable/12/contrib/libarchive/libarchive/archive_write_add_filter_xz.c stable/12/contrib/libarchive/libarchive/archive_write_disk_posix.c stable/12/contrib/libarchive/libarchive/archive_write_open.3 stable/12/contrib/libarchive/libarchive/archive_write_open_fd.c stable/12/contrib/libarchive/libarchive/archive_write_open_file.c stable/12/contrib/libarchive/libarchive/archive_write_open_filename.c stable/12/contrib/libarchive/libarchive/archive_write_open_memory.c stable/12/contrib/libarchive/libarchive/archive_write_private.h stable/12/contrib/libarchive/libarchive/archive_write_set_format_7zip.c stable/12/contrib/libarchive/libarchive/archive_write_set_format_cpio.c stable/12/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c stable/12/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c stable/12/contrib/libarchive/libarchive/archive_write_set_format_mtree.c stable/12/contrib/libarchive/libarchive/archive_write_set_format_xar.c stable/12/contrib/libarchive/libarchive/archive_write_set_format_zip.c stable/12/contrib/libarchive/libarchive/test/test_archive_read_next_header_empty.c stable/12/contrib/libarchive/libarchive/test/test_archive_read_support.c stable/12/contrib/libarchive/libarchive/test/test_archive_string_conversion.c stable/12/contrib/libarchive/libarchive/test/test_entry.c stable/12/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c stable/12/contrib/libarchive/libarchive/test/test_read_format_mtree.c stable/12/contrib/libarchive/libarchive/test/test_read_format_mtree.mtree.uu stable/12/contrib/libarchive/libarchive/test/test_read_format_raw.c stable/12/contrib/libarchive/libarchive/test/test_read_format_zip.c stable/12/contrib/libarchive/libarchive/test/test_read_set_format.c stable/12/contrib/libarchive/libarchive/test/test_write_disk_secure.c stable/12/contrib/libarchive/libarchive/test/test_write_format_cpio.c stable/12/contrib/libarchive/libarchive/test/test_write_format_warc.c stable/12/contrib/libarchive/test_utils/test_common.h stable/12/contrib/libarchive/test_utils/test_main.c stable/12/lib/libarchive/Makefile stable/12/lib/libarchive/config_freebsd.h stable/12/lib/libarchive/tests/Makefile stable/12/usr.bin/bsdcat/Makefile stable/12/usr.bin/cpio/Makefile stable/12/usr.bin/tar/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/libarchive/COPYING ============================================================================== --- stable/12/contrib/libarchive/COPYING Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/COPYING Wed Dec 16 22:24:20 2020 (r368706) @@ -15,7 +15,6 @@ the actual statements in the files are controlling. * The following source files are also subject in whole or in part to a 3-clause UC Regents copyright; please read the individual source files for details: - libarchive/archive_entry.c libarchive/archive_read_support_filter_compress.c libarchive/archive_write_add_filter_compress.c libarchive/mtree.5 Modified: stable/12/contrib/libarchive/NEWS ============================================================================== --- stable/12/contrib/libarchive/NEWS Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/NEWS Wed Dec 16 22:24:20 2020 (r368706) @@ -1,3 +1,7 @@ +Dec 01, 2020: libarchive 3.5.0 released + +Oct 14, 2020: Support for system extended attributes + May 20, 2020: libarchive 3.4.3 released Apr 30, 2020: Support for pzstd compressed files Modified: stable/12/contrib/libarchive/libarchive/archive.h ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive.h Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive.h Wed Dec 16 22:24:20 2020 (r368706) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3004003 +#define ARCHIVE_VERSION_NUMBER 3005000 #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.4.3" +#define ARCHIVE_VERSION_ONLY_STRING "3.5.0" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); @@ -246,6 +246,8 @@ typedef int archive_open_callback(struct archive *, vo typedef int archive_close_callback(struct archive *, void *_client_data); +typedef int archive_free_callback(struct archive *, void *_client_data); + /* Switches from one client data object to the next/prev client data object. * This is useful for reading from different data blocks such as a set of files * that make up one large file. @@ -418,6 +420,7 @@ __LA_DECL int archive_read_support_compression_xz(stru #endif __LA_DECL int archive_read_support_filter_all(struct archive *); +__LA_DECL int archive_read_support_filter_by_code(struct archive *, int); __LA_DECL int archive_read_support_filter_bzip2(struct archive *); __LA_DECL int archive_read_support_filter_compress(struct archive *); __LA_DECL int archive_read_support_filter_gzip(struct archive *); @@ -817,9 +820,13 @@ __LA_DECL int archive_write_set_format_filter_by_ext(s __LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext); __LA_DECL int archive_write_zip_set_compression_deflate(struct archive *); __LA_DECL int archive_write_zip_set_compression_store(struct archive *); +/* Deprecated; use archive_write_open2 instead */ __LA_DECL int archive_write_open(struct archive *, void *, archive_open_callback *, archive_write_callback *, archive_close_callback *); +__LA_DECL int archive_write_open2(struct archive *, void *, + archive_open_callback *, archive_write_callback *, + archive_close_callback *, archive_free_callback *); __LA_DECL int archive_write_open_fd(struct archive *, int _fd); __LA_DECL int archive_write_open_filename(struct archive *, const char *_file); __LA_DECL int archive_write_open_filename_w(struct archive *, Modified: stable/12/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_acl.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_acl.c Wed Dec 16 22:24:20 2020 (r368706) @@ -595,7 +595,7 @@ archive_acl_text_len(struct archive_acl *acl, int want else length += sizeof(uid_t) * 3 + 1; } else { - r = archive_mstring_get_mbs_l(&ap->name, &name, + r = archive_mstring_get_mbs_l(a, &ap->name, &name, &len, sc); if (r != 0) return (0); @@ -968,7 +968,7 @@ archive_acl_to_text_l(struct archive_acl *acl, ssize_t else prefix = NULL; r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); + NULL, &ap->name, &name, &len, sc); if (r != 0) { free(s); return (NULL); @@ -1402,14 +1402,14 @@ isint_w(const wchar_t *start, const wchar_t *end, int if (start >= end) return (0); while (start < end) { - if (*start < '0' || *start > '9') + if (*start < L'0' || *start > L'9') return (0); if (n > (INT_MAX / 10) || - (n == INT_MAX / 10 && (*start - '0') > INT_MAX % 10)) { + (n == INT_MAX / 10 && (*start - L'0') > INT_MAX % 10)) { n = INT_MAX; } else { n *= 10; - n += *start - '0'; + n += *start - L'0'; } start++; } Modified: stable/12/contrib/libarchive/libarchive/archive_check_magic.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_check_magic.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_check_magic.c Wed Dec 16 22:24:20 2020 (r368706) @@ -54,7 +54,7 @@ errmsg(const char *m) ssize_t written; while (s > 0) { - written = write(2, m, strlen(m)); + written = write(2, m, s); if (written <= 0) return; m += written; Modified: stable/12/contrib/libarchive/libarchive/archive_cryptor.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_cryptor.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_cryptor.c Wed Dec 16 22:24:20 2020 (r368706) @@ -347,8 +347,31 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *k static int aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) { +#if NETTLE_VERSION_MAJOR < 3 aes_set_encrypt_key(&ctx->ctx, ctx->key_len, ctx->key); aes_encrypt(&ctx->ctx, AES_BLOCK_SIZE, ctx->encr_buf, ctx->nonce); +#else + switch(ctx->key_len) { + case AES128_KEY_SIZE: + aes128_set_encrypt_key(&ctx->ctx.c128, ctx->key); + aes128_encrypt(&ctx->ctx.c128, AES_BLOCK_SIZE, ctx->encr_buf, + ctx->nonce); + break; + case AES192_KEY_SIZE: + aes192_set_encrypt_key(&ctx->ctx.c192, ctx->key); + aes192_encrypt(&ctx->ctx.c192, AES_BLOCK_SIZE, ctx->encr_buf, + ctx->nonce); + break; + case AES256_KEY_SIZE: + aes256_set_encrypt_key(&ctx->ctx.c256, ctx->key); + aes256_encrypt(&ctx->ctx.c256, AES_BLOCK_SIZE, ctx->encr_buf, + ctx->nonce); + break; + default: + return -1; + break; + } +#endif return 0; } Modified: stable/12/contrib/libarchive/libarchive/archive_cryptor_private.h ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_cryptor_private.h Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_cryptor_private.h Wed Dec 16 22:24:20 2020 (r368706) @@ -104,9 +104,18 @@ typedef struct { #include #endif #include +#include typedef struct { +#if NETTLE_VERSION_MAJOR < 3 struct aes_ctx ctx; +#else + union { + struct aes128_ctx c128; + struct aes192_ctx c192; + struct aes256_ctx c256; + } ctx; +#endif uint8_t key[AES_MAX_KEY_SIZE]; unsigned key_len; uint8_t nonce[AES_BLOCK_SIZE]; Modified: stable/12/contrib/libarchive/libarchive/archive_digest_private.h ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_digest_private.h Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_digest_private.h Wed Dec 16 22:24:20 2020 (r368706) @@ -30,6 +30,10 @@ #ifndef __LIBARCHIVE_BUILD #error This header is only to be used internally to libarchive. #endif +#ifndef __LIBARCHIVE_CONFIG_H_INCLUDED +#error "Should have include config.h first!" +#endif + /* * Crypto support in various Operating Systems: * Modified: stable/12/contrib/libarchive/libarchive/archive_entry.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_entry.c Wed Dec 16 22:24:20 2020 (r368706) @@ -208,6 +208,19 @@ archive_entry_clone(struct archive_entry *entry) /* Copy encryption status */ entry2->encryption = entry->encryption; + + /* Copy digests */ +#define copy_digest(_e2, _e, _t) \ + memcpy(_e2->digest._t, _e->digest._t, sizeof(_e2->digest._t)) + + copy_digest(entry2, entry, md5); + copy_digest(entry2, entry, rmd160); + copy_digest(entry2, entry, sha1); + copy_digest(entry2, entry, sha256); + copy_digest(entry2, entry, sha384); + copy_digest(entry2, entry, sha512); + +#undef copy_digest /* Copy ACL data over. */ archive_acl_copy(&entry2->acl, &entry->acl); @@ -450,7 +463,7 @@ int _archive_entry_gname_l(struct archive_entry *entry, const char **p, size_t *len, struct archive_string_conv *sc) { - return (archive_mstring_get_mbs_l(&entry->ae_gname, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_gname, p, len, sc)); } const char * @@ -504,7 +517,7 @@ _archive_entry_hardlink_l(struct archive_entry *entry, *len = 0; return (0); } - return (archive_mstring_get_mbs_l(&entry->ae_hardlink, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_hardlink, p, len, sc)); } la_int64_t @@ -595,7 +608,7 @@ int _archive_entry_pathname_l(struct archive_entry *entry, const char **p, size_t *len, struct archive_string_conv *sc) { - return (archive_mstring_get_mbs_l(&entry->ae_pathname, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_pathname, p, len, sc)); } __LA_MODE_T @@ -723,7 +736,7 @@ _archive_entry_symlink_l(struct archive_entry *entry, *len = 0; return (0); } - return (archive_mstring_get_mbs_l( &entry->ae_symlink, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_symlink, p, len, sc)); } la_int64_t @@ -769,7 +782,7 @@ int _archive_entry_uname_l(struct archive_entry *entry, const char **p, size_t *len, struct archive_string_conv *sc) { - return (archive_mstring_get_mbs_l(&entry->ae_uname, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_uname, p, len, sc)); } int @@ -1414,6 +1427,62 @@ archive_entry_copy_mac_metadata(struct archive_entry * abort(); memcpy(entry->mac_metadata, p, s); } +} + +/* Digest handling */ +const unsigned char * +archive_entry_digest(struct archive_entry *entry, int type) +{ + switch (type) { + case ARCHIVE_ENTRY_DIGEST_MD5: + return entry->digest.md5; + case ARCHIVE_ENTRY_DIGEST_RMD160: + return entry->digest.rmd160; + case ARCHIVE_ENTRY_DIGEST_SHA1: + return entry->digest.sha1; + case ARCHIVE_ENTRY_DIGEST_SHA256: + return entry->digest.sha256; + case ARCHIVE_ENTRY_DIGEST_SHA384: + return entry->digest.sha384; + case ARCHIVE_ENTRY_DIGEST_SHA512: + return entry->digest.sha512; + default: + return NULL; + } +} + +int +archive_entry_set_digest(struct archive_entry *entry, int type, + const unsigned char *digest) +{ +#define copy_digest(_e, _t, _d)\ + memcpy(_e->digest._t, _d, sizeof(_e->digest._t)) + + switch (type) { + case ARCHIVE_ENTRY_DIGEST_MD5: + copy_digest(entry, md5, digest); + break; + case ARCHIVE_ENTRY_DIGEST_RMD160: + copy_digest(entry, rmd160, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA1: + copy_digest(entry, sha1, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA256: + copy_digest(entry, sha256, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA384: + copy_digest(entry, sha384, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA512: + copy_digest(entry, sha512, digest); + break; + default: + return ARCHIVE_WARN; + } + + return ARCHIVE_OK; +#undef copy_digest } /* Modified: stable/12/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry.h Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_entry.h Wed Dec 16 22:24:20 2020 (r368706) @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3004003 +#define ARCHIVE_VERSION_NUMBER 3005000 /* * Note: archive_entry.h is for use outside of libarchive; the @@ -395,6 +395,19 @@ __LA_DECL void archive_entry_copy_stat(struct archive_ __LA_DECL const void * archive_entry_mac_metadata(struct archive_entry *, size_t *); __LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const void *, size_t); + +/* + * Digest routine. This is used to query the raw hex digest for the + * given entry. The type of digest is provided as an argument. + */ +#define ARCHIVE_ENTRY_DIGEST_MD5 0x00000001 +#define ARCHIVE_ENTRY_DIGEST_RMD160 0x00000002 +#define ARCHIVE_ENTRY_DIGEST_SHA1 0x00000003 +#define ARCHIVE_ENTRY_DIGEST_SHA256 0x00000004 +#define ARCHIVE_ENTRY_DIGEST_SHA384 0x00000005 +#define ARCHIVE_ENTRY_DIGEST_SHA512 0x00000006 + +__LA_DECL const unsigned char * archive_entry_digest(struct archive_entry *, int /* type */); /* * ACL routines. This used to simply store and return text-format ACL Modified: stable/12/contrib/libarchive/libarchive/archive_entry_private.h ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry_private.h Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_entry_private.h Wed Dec 16 22:24:20 2020 (r368706) @@ -50,6 +50,15 @@ struct ae_sparse { int64_t length; }; +struct ae_digest { + unsigned char md5[16]; + unsigned char rmd160[20]; + unsigned char sha1[20]; + unsigned char sha256[32]; + unsigned char sha384[48]; + unsigned char sha512[64]; +}; + /* * Description of an archive entry. * @@ -162,6 +171,9 @@ struct archive_entry { void *mac_metadata; size_t mac_metadata_size; + /* Digest support. */ + struct ae_digest digest; + /* ACL support. */ struct archive_acl acl; @@ -180,5 +192,9 @@ struct archive_entry { /* Symlink type support */ int ae_symlink_type; }; + +int +archive_entry_set_digest(struct archive_entry *entry, int type, + const unsigned char *digest); #endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */ Modified: stable/12/contrib/libarchive/libarchive/archive_ppmd7.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_ppmd7.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_ppmd7.c Wed Dec 16 22:24:20 2020 (r368706) @@ -4,7 +4,7 @@ This code is based on PPMd var.H (2001): Dmitry Shkari #include "archive_platform.h" -#include +#include #include "archive_ppmd7_private.h" Modified: stable/12/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Wed Dec 16 22:24:20 2020 (r368706) @@ -103,6 +103,10 @@ __FBSDID("$FreeBSD"); static int setup_mac_metadata(struct archive_read_disk *, struct archive_entry *, int *fd); +#ifdef ARCHIVE_XATTR_FREEBSD +static int setup_xattrs_namespace(struct archive_read_disk *, + struct archive_entry *, int *, int); +#endif static int setup_xattrs(struct archive_read_disk *, struct archive_entry *, int *fd); static int setup_sparse(struct archive_read_disk *, @@ -701,14 +705,13 @@ setup_xattr(struct archive_read_disk *a, struct archiv } static int -setup_xattrs(struct archive_read_disk *a, - struct archive_entry *entry, int *fd) +setup_xattrs_namespace(struct archive_read_disk *a, + struct archive_entry *entry, int *fd, int namespace) { char buff[512]; char *list, *p; ssize_t list_size; const char *path; - int namespace = EXTATTR_NAMESPACE_USER; path = NULL; @@ -727,6 +730,8 @@ setup_xattrs(struct archive_read_disk *a, if (list_size == -1 && errno == EOPNOTSUPP) return (ARCHIVE_OK); + if (list_size == -1 && errno == EPERM) + return (ARCHIVE_OK); if (list_size == -1) { archive_set_error(&a->archive, errno, "Couldn't list extended attributes"); @@ -760,7 +765,17 @@ setup_xattrs(struct archive_read_disk *a, size_t len = 255 & (int)*p; char *name; - strcpy(buff, "user."); + if (namespace == EXTATTR_NAMESPACE_SYSTEM) { + if (!strcmp(p + 1, "nfs4.acl") || + !strcmp(p + 1, "posix1e.acl_access") || + !strcmp(p + 1, "posix1e.acl_default")) { + p += 1 + len; + continue; + } + strcpy(buff, "system."); + } else { + strcpy(buff, "user."); + } name = buff + strlen(buff); memcpy(name, p + 1, len); name[len] = '\0'; @@ -769,6 +784,31 @@ setup_xattrs(struct archive_read_disk *a, } free(list); + return (ARCHIVE_OK); +} + +static int +setup_xattrs(struct archive_read_disk *a, + struct archive_entry *entry, int *fd) +{ + int namespaces[2]; + int i, res; + + namespaces[0] = EXTATTR_NAMESPACE_USER; + namespaces[1] = EXTATTR_NAMESPACE_SYSTEM; + + for (i = 0; i < 2; i++) { + res = setup_xattrs_namespace(a, entry, fd, + namespaces[i]); + switch (res) { + case (ARCHIVE_OK): + case (ARCHIVE_WARN): + break; + default: + return (res); + } + } + return (ARCHIVE_OK); } Modified: stable/12/contrib/libarchive/libarchive/archive_read_filter.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_filter.3 Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_filter.3 Wed Dec 16 22:24:20 2020 (r368706) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2014 +.Dd June 9, 2020 .Dt ARCHIVE_READ_FILTER 3 .Os .Sh NAME @@ -50,6 +50,8 @@ Streaming Archive Library (libarchive, -larchive) .Ft int .Fn archive_read_support_filter_all "struct archive *" .Ft int +.Fn archive_read_support_filter_by_code "struct archive *" "int" +.Ft int .Fn archive_read_support_filter_bzip2 "struct archive *" .Ft int .Fn archive_read_support_filter_compress "struct archive *" @@ -116,6 +118,14 @@ Note that is always enabled by default. .It Fn archive_read_support_filter_all Enables all available decompression filters. +.It Fn archive_read_support_filter_by_code +Enables a single filter specified by the filter code. +This function does not work with +.Cm ARCHIVE_FILTER_PROGRAM . +Note: In statically-linked executables, this will cause +your program to include support for every filter. +If executable size is a concern, you may wish to avoid +using this function. .It Fn archive_read_support_filter_program Data is fed through the specified external program before being dearchived. Note that this disables automatic detection of the compression format, Modified: stable/12/contrib/libarchive/libarchive/archive_read_set_format.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_set_format.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_set_format.c Wed Dec 16 22:24:20 2020 (r368706) @@ -61,6 +61,9 @@ archive_read_set_format(struct archive *_a, int code) case ARCHIVE_FORMAT_CPIO: strcpy(str, "cpio"); break; + case ARCHIVE_FORMAT_EMPTY: + strcpy(str, "empty"); + break; case ARCHIVE_FORMAT_ISO9660: strcpy(str, "iso9660"); break; @@ -76,8 +79,14 @@ archive_read_set_format(struct archive *_a, int code) case ARCHIVE_FORMAT_RAR_V5: strcpy(str, "rar5"); break; + case ARCHIVE_FORMAT_RAW: + strcpy(str, "raw"); + break; case ARCHIVE_FORMAT_TAR: strcpy(str, "tar"); + break; + case ARCHIVE_FORMAT_WARC: + strcpy(str, "warc"); break; case ARCHIVE_FORMAT_XAR: strcpy(str, "xar"); Copied: stable/12/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c (from r368234, head/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c Wed Dec 16 22:24:20 2020 (r368706, copy of r368234, head/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c) @@ -0,0 +1,83 @@ +/*- + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#include "archive.h" +#include "archive_private.h" + +int +archive_read_support_filter_by_code(struct archive *a, int filter_code) +{ + archive_check_magic(a, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "archive_read_support_filter_by_code"); + + switch (filter_code) { + case ARCHIVE_FILTER_NONE: + return archive_read_support_filter_none(a); + break; + case ARCHIVE_FILTER_GZIP: + return archive_read_support_filter_gzip(a); + break; + case ARCHIVE_FILTER_BZIP2: + return archive_read_support_filter_bzip2(a); + break; + case ARCHIVE_FILTER_COMPRESS: + return archive_read_support_filter_compress(a); + break; + case ARCHIVE_FILTER_LZMA: + return archive_read_support_filter_lzma(a); + break; + case ARCHIVE_FILTER_XZ: + return archive_read_support_filter_xz(a); + break; + case ARCHIVE_FILTER_UU: + return archive_read_support_filter_uu(a); + break; + case ARCHIVE_FILTER_RPM: + return archive_read_support_filter_rpm(a); + break; + case ARCHIVE_FILTER_LZIP: + return archive_read_support_filter_lzip(a); + break; + case ARCHIVE_FILTER_LRZIP: + return archive_read_support_filter_lrzip(a); + break; + case ARCHIVE_FILTER_LZOP: + return archive_read_support_filter_lzop(a); + break; + case ARCHIVE_FILTER_GRZIP: + return archive_read_support_filter_grzip(a); + break; + case ARCHIVE_FILTER_LZ4: + return archive_read_support_filter_lz4(a); + break; + case ARCHIVE_FILTER_ZSTD: + return archive_read_support_filter_zstd(a); + break; + } + return (ARCHIVE_FATAL); +} Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_by_code.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_by_code.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_by_code.c Wed Dec 16 22:24:20 2020 (r368706) @@ -26,6 +26,10 @@ #include "archive_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_ERRNO_H +#include +#endif + #include "archive.h" #include "archive_private.h" @@ -48,6 +52,9 @@ archive_read_support_format_by_code(struct archive *a, case ARCHIVE_FORMAT_CPIO: return archive_read_support_format_cpio(a); break; + case ARCHIVE_FORMAT_EMPTY: + return archive_read_support_format_empty(a); + break; case ARCHIVE_FORMAT_ISO9660: return archive_read_support_format_iso9660(a); break; @@ -63,9 +70,15 @@ archive_read_support_format_by_code(struct archive *a, case ARCHIVE_FORMAT_RAR_V5: return archive_read_support_format_rar5(a); break; + case ARCHIVE_FORMAT_RAW: + return archive_read_support_format_raw(a); + break; case ARCHIVE_FORMAT_TAR: return archive_read_support_format_tar(a); break; + case ARCHIVE_FORMAT_WARC: + return archive_read_support_format_warc(a); + break; case ARCHIVE_FORMAT_XAR: return archive_read_support_format_xar(a); break; @@ -73,5 +86,7 @@ archive_read_support_format_by_code(struct archive *a, return archive_read_support_format_zip(a); break; } + archive_set_error(a, ARCHIVE_ERRNO_PROGRAMMER, + "Invalid format code specified"); return (ARCHIVE_FATAL); } Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_cab.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_cab.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_cab.c Wed Dec 16 22:24:20 2020 (r368706) @@ -1172,7 +1172,7 @@ cab_checksum_finish(struct archive_read *a) cfdata->memimage + CFDATA_cbData, l, cfdata->sum_calculated); if (cfdata->sum_calculated != cfdata->sum) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Checksum error CFDATA[%d] %x:%x in %d bytes", + "Checksum error CFDATA[%d] %" PRIx32 ":%" PRIx32 " in %d bytes", cab->entry_cffolder->cfdata_index -1, cfdata->sum, cfdata->sum_calculated, cfdata->compressed_size); Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_empty.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_empty.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_empty.c Wed Dec 16 22:24:20 2020 (r368706) @@ -47,7 +47,7 @@ archive_read_support_format_empty(struct archive *_a) r = __archive_read_register_format(a, NULL, - NULL, + "empty", archive_read_format_empty_bid, NULL, archive_read_format_empty_read_header, Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed Dec 16 22:24:20 2020 (r368706) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "archive.h" #include "archive_entry.h" +#include "archive_entry_private.h" #include "archive_private.h" #include "archive_rb.h" #include "archive_read_private.h" @@ -135,6 +136,9 @@ static int skip(struct archive_read *a); static int read_header(struct archive_read *, struct archive_entry *); static int64_t mtree_atol(char **, int base); +#ifndef HAVE_STRNLEN +static size_t mtree_strnlen(const char *, size_t); +#endif /* * There's no standard for TIME_T_MAX/TIME_T_MIN. So we compute them @@ -186,6 +190,24 @@ get_time_t_min(void) #endif } +#ifdef HAVE_STRNLEN +#define mtree_strnlen(a,b) strnlen(a,b) +#else +static size_t +mtree_strnlen(const char *p, size_t maxlen) +{ + size_t i; + + for (i = 0; i <= maxlen; i++) { + if (p[i] == 0) + break; + } + if (i > maxlen) + return (-1);/* invalid */ + return (i); +} +#endif + static int archive_read_format_mtree_options(struct archive_read *a, const char *key, const char *val) @@ -1482,6 +1504,84 @@ parse_device(dev_t *pdev, struct archive *a, char *val #undef MAX_PACK_ARGS } +static int +parse_hex_nibble(char c) +{ + if (c >= '0' && c <= '9') + return c - '0'; + if (c >= 'a' && c <= 'f') + return 10 + c - 'a'; +#if 0 + /* XXX: Is uppercase something we should support? */ + if (c >= 'A' && c <= 'F') + return 10 + c - 'A'; +#endif + + return -1; +} + +static int +parse_digest(struct archive_read *a, struct archive_entry *entry, + const char *digest, int type) +{ + unsigned char digest_buf[64]; + int high, low; + size_t i, j, len; + + switch (type) { + case ARCHIVE_ENTRY_DIGEST_MD5: + len = sizeof(entry->digest.md5); + break; + case ARCHIVE_ENTRY_DIGEST_RMD160: + len = sizeof(entry->digest.rmd160); + break; + case ARCHIVE_ENTRY_DIGEST_SHA1: + len = sizeof(entry->digest.sha1); + break; + case ARCHIVE_ENTRY_DIGEST_SHA256: + len = sizeof(entry->digest.sha256); + break; + case ARCHIVE_ENTRY_DIGEST_SHA384: + len = sizeof(entry->digest.sha384); + break; + case ARCHIVE_ENTRY_DIGEST_SHA512: + len = sizeof(entry->digest.sha512); + break; + default: + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "Internal error: Unknown digest type"); + return ARCHIVE_FATAL; + } + + if (len > sizeof(digest_buf)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "Internal error: Digest storage too large"); + return ARCHIVE_FATAL; + } + + len *= 2; + + if (mtree_strnlen(digest, len+1) != len) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "incorrect digest length, ignoring"); + return ARCHIVE_WARN; + } + + for (i = 0, j = 0; i < len; i += 2, j++) { + high = parse_hex_nibble(digest[i]); + low = parse_hex_nibble(digest[i+1]); + if (high == -1 || low == -1) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "invalid digest data, ignoring"); + return ARCHIVE_WARN; + } + + digest_buf[j] = high << 4 | low; + } + + return archive_entry_set_digest(entry, type, digest_buf); +} + /* * Parse a single keyword and its value. */ @@ -1580,8 +1680,10 @@ parse_keyword(struct archive_read *a, struct mtree *mt } __LA_FALLTHROUGH; case 'm': - if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) - break; + if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_MD5); + } if (strcmp(key, "mode") == 0) { if (val[0] >= '0' && val[0] <= '7') { *parsed_kws |= MTREE_HAS_PERM; @@ -1617,21 +1719,32 @@ parse_keyword(struct archive_read *a, struct mtree *mt return r; } if (strcmp(key, "rmd160") == 0 || - strcmp(key, "rmd160digest") == 0) - break; + strcmp(key, "rmd160digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_RMD160); + } __LA_FALLTHROUGH; case 's': - if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) - break; + if (strcmp(key, "sha1") == 0 || + strcmp(key, "sha1digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA1); + } if (strcmp(key, "sha256") == 0 || - strcmp(key, "sha256digest") == 0) - break; + strcmp(key, "sha256digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA256); + } if (strcmp(key, "sha384") == 0 || - strcmp(key, "sha384digest") == 0) - break; + strcmp(key, "sha384digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA384); + } if (strcmp(key, "sha512") == 0 || - strcmp(key, "sha512digest") == 0) - break; + strcmp(key, "sha512digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA512); + } if (strcmp(key, "size") == 0) { archive_entry_set_size(entry, mtree_atol(&val, 10)); break; Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar.c Wed Dec 16 22:24:20 2020 (r368706) @@ -151,6 +151,9 @@ #undef minimum #define minimum(a, b) ((a)<(b)?(a):(b)) +/* Stack overflow check */ +#define MAX_COMPRESS_DEPTH 1024 + /* Fields common to all headers */ struct rar_header { @@ -340,7 +343,7 @@ static int read_symlink_stored(struct archive_read *, static int read_data_stored(struct archive_read *, const void **, size_t *, int64_t *); static int read_data_compressed(struct archive_read *, const void **, size_t *, - int64_t *); + int64_t *, size_t); static int rar_br_preparation(struct archive_read *, struct rar_br *); static int parse_codes(struct archive_read *); static void free_codes(struct archive_read *); @@ -1026,7 +1029,7 @@ archive_read_format_rar_read_data(struct archive_read case COMPRESS_METHOD_NORMAL: case COMPRESS_METHOD_GOOD: case COMPRESS_METHOD_BEST: - ret = read_data_compressed(a, buff, size, offset); + ret = read_data_compressed(a, buff, size, offset, 0); if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) { __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->start_new_table = 1; @@ -1883,8 +1886,11 @@ read_data_stored(struct archive_read *a, const void ** static int read_data_compressed(struct archive_read *a, const void **buff, size_t *size, - int64_t *offset) + int64_t *offset, size_t looper) { + if (looper++ > MAX_COMPRESS_DEPTH) + return (ARCHIVE_FATAL); + struct rar *rar; int64_t start, end, actualend; size_t bs; @@ -1982,7 +1988,7 @@ read_data_compressed(struct archive_read *a, const voi { case 0: rar->start_new_table = 1; - return read_data_compressed(a, buff, size, offset); + return read_data_compressed(a, buff, size, offset, looper); case 2: rar->ppmd_eod = 1;/* End Of ppmd Data. */ Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Wed Dec 16 22:24:20 2020 (r368706) @@ -3831,7 +3831,7 @@ static int verify_checksums(struct archive_read* a) { DEBUG_CODE { printf("Checksum error: CRC32 " - "(was: %08x, expected: %08x)\n", + "(was: %08" PRIx32 ", expected: %08" PRIx32 ")\n", rar->file.calculated_crc32, rar->file.stored_crc32); } @@ -3845,7 +3845,7 @@ static int verify_checksums(struct archive_read* a) { } else { DEBUG_CODE { printf("Checksum OK: CRC32 " - "(%08x/%08x)\n", + "(%08" PRIx32 "/%08" PRIx32 ")\n", rar->file.stored_crc32, rar->file.calculated_crc32); } @@ -3905,6 +3905,9 @@ static int rar5_read_data(struct archive_read *a, cons size_t *size, int64_t *offset) { int ret; struct rar5* rar = get_context(a); + + if (size) + *size = 0; if(rar->file.dir > 0) { /* Don't process any data if this file entry was declared Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_warc.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_warc.c Wed Dec 16 20:21:56 2020 (r368705) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_warc.c Wed Dec 16 22:24:20 2020 (r368706) @@ -127,7 +127,7 @@ static int _warc_skip(struct archive_read *a); static int _warc_rdhdr(struct archive_read *a, struct archive_entry *e); /* private routines */ -static unsigned int _warc_rdver(const char buf[10], size_t bsz); +static unsigned int _warc_rdver(const char *buf, size_t bsz); static unsigned int _warc_rdtyp(const char *buf, size_t bsz); static warc_string_t _warc_rduri(const char *buf, size_t bsz); static ssize_t _warc_rdlen(const char *buf, size_t bsz); @@ -337,6 +337,14 @@ start_over: mtime = rtime; } break; + case WT_NONE: + case WT_INFO: + case WT_META: + case WT_REQ: + case WT_RVIS: + case WT_CONV: + case WT_CONT: + case LAST_WT: default: fnam.len = 0U; fnam.str = NULL; @@ -361,6 +369,14 @@ start_over: *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***