diff options
author | Martin Matuska <mm@FreeBSD.org> | 2023-09-07 14:21:24 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2023-09-07 14:21:24 +0000 |
commit | a5913a473bb0b6e194a2fe0e55d3166e0eed8aaf (patch) | |
tree | a57d872eaeeae527a3e53bda58b8ba628a1444fd | |
parent | 80517d0d48d96fdd3e9c80d30eb30289d5004133 (diff) | |
download | src-vendor/libarchive.tar.gz src-vendor/libarchive.zip |
Update vendor/libarchive to libarchive/libarchive@1b4e0d0f9vendor/libarchive
Changes to not yet connected unzip command only.
Obtained from: libarchive
Libarchive commit: 1b4e0d0f9d445ba3e4d0c7db7ce0b30300572fe8
-rwxr-xr-x | build/ci/github_actions/ci.cmd | 6 | ||||
-rw-r--r-- | libarchive/archive_write_set_format_pax.c | 35 |
2 files changed, 28 insertions, 13 deletions
diff --git a/build/ci/github_actions/ci.cmd b/build/ci/github_actions/ci.cmd index a9cb61553e43..742ede66ab9d 100755 --- a/build/ci/github_actions/ci.cmd +++ b/build/ci/github_actions/ci.cmd @@ -1,8 +1,8 @@ @ECHO OFF -SET ZLIB_VERSION=1.2.12 +SET ZLIB_VERSION=1.2.13 SET BZIP2_VERSION=1ea1ac188ad4b9cb662e3f8314673c63df95a589 -SET XZ_VERSION=5.2.5 -SET ZSTD_VERSION=1.5.2 +SET XZ_VERSION=5.4.4 +SET ZSTD_VERSION=1.5.5 IF NOT "%BE%"=="mingw-gcc" ( IF NOT "%BE%"=="msvc" ( ECHO Environment variable BE must be mingw-gcc or msvc diff --git a/libarchive/archive_write_set_format_pax.c b/libarchive/archive_write_set_format_pax.c index c9c159164680..1eb9a9a4b634 100644 --- a/libarchive/archive_write_set_format_pax.c +++ b/libarchive/archive_write_set_format_pax.c @@ -368,10 +368,12 @@ archive_write_pax_header_xattr(struct pax *pax, const char *encoded_name, struct archive_string s; char *encoded_value; + if (encoded_name == NULL) + return; + if (pax->flags & WRITE_LIBARCHIVE_XATTR) { encoded_value = base64_encode((const char *)value, value_len); - - if (encoded_name != NULL && encoded_value != NULL) { + if (encoded_value != NULL) { archive_string_init(&s); archive_strcpy(&s, "LIBARCHIVE.xattr."); archive_strcat(&s, encoded_name); @@ -404,17 +406,22 @@ archive_write_pax_header_xattrs(struct archive_write *a, archive_entry_xattr_next(entry, &name, &value, &size); url_encoded_name = url_encode(name); - if (url_encoded_name != NULL) { + if (url_encoded_name == NULL) + goto malloc_error; + else { /* Convert narrow-character to UTF-8. */ r = archive_strcpy_l(&(pax->l_url_encoded_name), url_encoded_name, pax->sconv_utf8); free(url_encoded_name); /* Done with this. */ if (r == 0) encoded_name = pax->l_url_encoded_name.s; - else if (errno == ENOMEM) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Linkname"); - return (ARCHIVE_FATAL); + else if (r == -1) + goto malloc_error; + else { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Error encoding pax extended attribute"); + return (ARCHIVE_FAILED); } } @@ -423,6 +430,9 @@ archive_write_pax_header_xattrs(struct archive_write *a, } return (ARCHIVE_OK); +malloc_error: + archive_set_error(&a->archive, ENOMEM, "Can't allocate memory"); + return (ARCHIVE_FATAL); } static int @@ -1904,14 +1914,19 @@ url_encode(const char *in) { const char *s; char *d; - int out_len = 0; + size_t out_len = 0; char *out; for (s = in; *s != '\0'; s++) { - if (*s < 33 || *s > 126 || *s == '%' || *s == '=') + if (*s < 33 || *s > 126 || *s == '%' || *s == '=') { + if (SIZE_MAX - out_len < 4) + return (NULL); out_len += 3; - else + } else { + if (SIZE_MAX - out_len < 2) + return (NULL); out_len++; + } } out = (char *)malloc(out_len + 1); |