aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2022-03-26 09:46:31 +0000
committerMartin Matuska <mm@FreeBSD.org>2022-03-26 09:56:58 +0000
commitb36466f05a59c7b508ed5c1952079a3769d686b8 (patch)
treef925a081d4e5f7634044717cc5753e92c8c22985
parent8b3c99225118107bf1b80fe5d275b268d7790f77 (diff)
downloadsrc-b36466f05a59c7b508ed5c1952079a3769d686b8.tar.gz
src-b36466f05a59c7b508ed5c1952079a3769d686b8.zip
Update vendor/libarchive to libarchive/libarchive@cfaa28168
Bugfixes: IS #1672 and OSS-Fuzz #38766: (zip reader) fix possible out-of-bounds read in zipx_lzma_alone_init() PR #1676: (mtree reader) remove the unused variable "detected_bytes" PR #1674: (doc) fix use of At mdoc(7) macro in cpio.5 Obtained from: libarchive Libarchive commit: cfaa28168a07ea4a53276b63068f94fce37d6aff
-rw-r--r--configure.ac4
-rw-r--r--libarchive/archive_read_disk_posix.c7
-rw-r--r--libarchive/archive_read_support_format_mtree.c5
-rw-r--r--libarchive/archive_read_support_format_zip.c2
-rw-r--r--libarchive/cpio.52
5 files changed, 11 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 05aa0407b678..2c9e1f957e11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -715,14 +715,14 @@ AC_CHECK_TYPES(struct statfs,,,
# There are several variants of readdir_r around; we only
# accept the POSIX-compliant version.
-AC_COMPILE_IFELSE(
+AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <dirent.h>]],
[[DIR *dir; struct dirent e, *r;
return(readdir_r(dir, &e, &r));]])],
[AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])]
)
# dirfd can be either a function or a macro.
-AC_COMPILE_IFELSE(
+AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <dirent.h>
DIR *dir;]],
[[return(dirfd(dir));]])],
diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c
index d0e1f35c8291..2b39e672b49c 100644
--- a/libarchive/archive_read_disk_posix.c
+++ b/libarchive/archive_read_disk_posix.c
@@ -109,6 +109,11 @@ __FBSDID("$FreeBSD$");
#define O_CLOEXEC 0
#endif
+#if defined(__hpux) && !defined(HAVE_DIRFD)
+#define dirfd(x) ((x)->__dd_fd)
+#define HAVE_DIRFD
+#endif
+
/*-
* This is a new directory-walking system that addresses a number
* of problems I've had with fts(3). In particular, it has no
@@ -2428,7 +2433,7 @@ tree_dir_next_posix(struct tree *t)
#else /* HAVE_FDOPENDIR */
if (tree_enter_working_dir(t) == 0) {
t->d = opendir(".");
-#if HAVE_DIRFD || defined(dirfd)
+#ifdef HAVE_DIRFD
__archive_ensure_cloexec_flag(dirfd(t->d));
#endif
}
diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c
index 88bca76fb915..4a2816325f22 100644
--- a/libarchive/archive_read_support_format_mtree.c
+++ b/libarchive/archive_read_support_format_mtree.c
@@ -692,7 +692,7 @@ detect_form(struct archive_read *a, int *is_form_d)
{
const char *p;
ssize_t avail, ravail;
- ssize_t detected_bytes = 0, len, nl;
+ ssize_t len, nl;
int entry_cnt = 0, multiline = 0;
int form_D = 0;/* The archive is generated by `NetBSD mtree -D'
* (In this source we call it `form D') . */
@@ -728,8 +728,6 @@ detect_form(struct archive_read *a, int *is_form_d)
* character of previous line was '\' character. */
if (bid_keyword_list(p, len, 0, 0) <= 0)
break;
- if (multiline == 1)
- detected_bytes += len;
if (p[len-nl-1] != '\\') {
if (multiline == 1 &&
++entry_cnt >= MAX_BID_ENTRY)
@@ -745,7 +743,6 @@ detect_form(struct archive_read *a, int *is_form_d)
keywords = bid_entry(p, len, nl, &last_is_path);
if (keywords >= 0) {
- detected_bytes += len;
if (form_D == 0) {
if (last_is_path)
form_D = 1;
diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c
index 38ada70b5577..9d6c900b2c6e 100644
--- a/libarchive/archive_read_support_format_zip.c
+++ b/libarchive/archive_read_support_format_zip.c
@@ -1667,7 +1667,7 @@ zipx_lzma_alone_init(struct archive_read *a, struct zip *zip)
*/
/* Read magic1,magic2,lzma_params from the ZIPX stream. */
- if((p = __archive_read_ahead(a, 9, NULL)) == NULL) {
+ if(zip->entry_bytes_remaining < 9 || (p = __archive_read_ahead(a, 9, NULL)) == NULL) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Truncated lzma data");
return (ARCHIVE_FATAL);
diff --git a/libarchive/cpio.5 b/libarchive/cpio.5
index 837a45692e3b..c71018b1996e 100644
--- a/libarchive/cpio.5
+++ b/libarchive/cpio.5
@@ -354,7 +354,7 @@ while working in AT&T's Unix Support Group.
It appeared in 1977 as part of PWB/UNIX 1.0, the
.Dq Programmer's Work Bench
derived from
-.At 6th Edition UNIX
+.At v6
that was used internally at AT&T.
Both the new binary and old character formats were in use
by 1980, according to the System III source released