aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_set_format_ustar.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2020-02-11 23:48:03 +0000
committerMartin Matuska <mm@FreeBSD.org>2020-02-11 23:48:03 +0000
commit8185c4ae244f9a52ad987b36e7d6300500054d00 (patch)
tree11e2d7cd0caf20998ed1e1146e1c1d7fc747165e /libarchive/archive_write_set_format_ustar.c
parent98c1f51f769841d99d879099f9075ff60d51ee4a (diff)
downloadsrc-8185c4ae244f9a52ad987b36e7d6300500054d00.tar.gz
src-8185c4ae244f9a52ad987b36e7d6300500054d00.zip
Update vendor/libarchive/dist to git 3288ebb0353beb51dfb09d444dedbe9235ead53dvendor/libarchive/3.4.2
Libarchive 3.4.2 Relevant vendor changes: PR #1289: atomic extraction support (bsdtar -x --safe-writes) PR #1308: big endian fix for UTF16 support in LHA reader PR #1326: reject RAR5 files that declare invalid header flags Issue #987: fix support 7z archive entries with Delta filter Issue #1317: fix compression output buffer handling in XAR writer Issue #1319: fix uname or gname longer than 32 characters in pax writer Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR Use localtime_r() and gmtime_r() instead of localtime() and gmtime()
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=357783 svn path=/vendor/libarchive/3.4.2/; revision=357784; tag=vendor/libarchive/3.4.2
Diffstat (limited to 'libarchive/archive_write_set_format_ustar.c')
-rw-r--r--libarchive/archive_write_set_format_ustar.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/libarchive/archive_write_set_format_ustar.c b/libarchive/archive_write_set_format_ustar.c
index ad4ccb77ea53..d1a06bc4f7ec 100644
--- a/libarchive/archive_write_set_format_ustar.c
+++ b/libarchive/archive_write_set_format_ustar.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_ustar.c 191579
#include "archive_entry_locale.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct ustar {
uint64_t entry_bytes_remaining;
@@ -512,9 +513,11 @@ __archive_write_format_header_ustar(struct archive_write *a, char h[512],
}
if (copy_length > 0) {
if (copy_length > USTAR_uname_size) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Username too long");
- ret = ARCHIVE_FAILED;
+ if (tartype != 'x') {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC, "Username too long");
+ ret = ARCHIVE_FAILED;
+ }
copy_length = USTAR_uname_size;
}
memcpy(h + USTAR_uname_offset, p, copy_length);
@@ -535,9 +538,11 @@ __archive_write_format_header_ustar(struct archive_write *a, char h[512],
}
if (copy_length > 0) {
if (strlen(p) > USTAR_gname_size) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Group name too long");
- ret = ARCHIVE_FAILED;
+ if (tartype != 'x') {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC, "Group name too long");
+ ret = ARCHIVE_FAILED;
+ }
copy_length = USTAR_gname_size;
}
memcpy(h + USTAR_gname_offset, p, copy_length);
@@ -609,16 +614,9 @@ __archive_write_format_header_ustar(struct archive_write *a, char h[512],
case AE_IFBLK: h[USTAR_typeflag_offset] = '4' ; break;
case AE_IFDIR: h[USTAR_typeflag_offset] = '5' ; break;
case AE_IFIFO: h[USTAR_typeflag_offset] = '6' ; break;
- case AE_IFSOCK:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive socket");
- return (ARCHIVE_FAILED);
- default:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive this (mode=0%lo)",
- (unsigned long)archive_entry_mode(entry));
+ default: /* AE_IFSOCK and unknown */
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "ustar");
ret = ARCHIVE_FAILED;
}
}