From 95162014754fca037510884f5a3c0c73988cd902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz=20=28arab=2C=20vx?= =?UTF-8?q?p=29?= Date: Thu, 9 Jun 2016 18:58:37 +0000 Subject: Adds and integrates slibtool: - Adds ${PKG_SLIBTOOL}. - pkg.build: export ${MAKE} as `make LIBTOOL=${PKG_SLIBTOOL}'. - binutils{_host,}: use slibtool-static. - git: add NEEDS_SSL_WITH_CURL=1 to ${PKG_GIT_MAKEFLAGS_BUILD_EXTRA}. - pacman-5.0.1: add `LIBALPM_LIBS=-lssl -lbz2 -llzma -lz' to ${PKG_PACMAN_ENV_VARS_EXTRA}; Makefile.am patch. Introduces 32-bit (i686-nt32-midipix) support, selected by ARCH=nt32 and defaulting to 64-bit builds: - Create ${PREFIX_TARGET}/lib. - Remove ${PREFIX_TARGET} when cleaning the prefix if -c has been specified. - Set ${HOST_NATIVE}, ${TARGET}, and ${TARBALL_{SRC_,}FNAME_PREFIX} from ${ARCH}. - pkg.build: use ${TARGET}-dlltool instead of x86_64-nt64-midipix-dlltool. - glib-2.46.2: broken at present. - libffi-3.2.1/src/x86/win32.S: fix symbol prefix. - musl-1.1.12/arch/nt32/bits/syscall.h: copied from musl-1.1.12/arch/nt64/bits/syscall.h. - perl-5.22.1: Set --target from ${TARGET}. Bug fixes: - psxstub: make {_,__}so_entry_point weak symbols to express preference for the real psxscl shared object. - bash-4.3: fix lib/intl/libgnuintl.h issue. - libarchive-3.1.2: import FreeBSD-SA-16:23.libarchive and FreeBSD-SA-16:22.libarchive security fixes. Include all directories beneath ${WORKDIR} in the source tarball. Updated TODO list at the end of README. --- libarchive-3.1.2.local.patch | 139 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) (limited to 'libarchive-3.1.2.local.patch') diff --git a/libarchive-3.1.2.local.patch b/libarchive-3.1.2.local.patch index 1de46e28..1c5aa846 100644 --- a/libarchive-3.1.2.local.patch +++ b/libarchive-3.1.2.local.patch @@ -38,3 +38,142 @@ + ;; +esac + +--- libarchive-3.1.2/cpio/bsdcpio.1.orig ++++ libarchive-3.1.2/cpio/bsdcpio.1 +@@ -156,7 +156,8 @@ + .It Fl Fl insecure + (i and p mode only) + Disable security checks during extraction or copying. +-This allows extraction via symbolic links and path names containing ++This allows extraction via symbolic links, absolute paths, ++and path names containing + .Sq .. + in the name. + .It Fl J , Fl Fl xz +--- libarchive-3.1.2/cpio/cpio.c.orig ++++ libarchive-3.1.2/cpio/cpio.c +@@ -179,6 +179,7 @@ + cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER; + cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS; + cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT; ++ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; + cpio->extract_flags |= ARCHIVE_EXTRACT_PERM; + cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; + cpio->extract_flags |= ARCHIVE_EXTRACT_ACL; +@@ -264,6 +265,7 @@ + case OPTION_INSECURE: + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; ++ cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; + break; + case 'L': /* GNU cpio */ + cpio->option_follow_links = 1; +@@ -300,6 +302,7 @@ + "Cannot use both -p and -%c", cpio->mode); + cpio->mode = opt; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; ++ cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; + break; + case OPTION_PRESERVE_OWNER: + cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER; +--- libarchive-3.1.2/libarchive/archive.h.orig ++++ libarchive-3.1.2/libarchive/archive.h +@@ -562,6 +562,8 @@ + /* Default: Do not use HFS+ compression if it was not compressed. */ + /* This has no effect except on Mac OS v10.6 or later. */ + #define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000) ++/* Default: Do not reject entries with absolute paths */ ++#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000) + + __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *, + int flags); +--- libarchive-3.1.2/libarchive/archive_write_disk.3.orig ++++ libarchive-3.1.2/libarchive/archive_write_disk.3 +@@ -177,6 +177,9 @@ + Note that paths ending in + .Pa .. + always cause an error, regardless of this flag. ++.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS ++Refuse to extract an absolute path. ++The default is to not refuse such paths. + .It Cm ARCHIVE_EXTRACT_SPARSE + Scan data for blocks of NUL bytes and try to recreate them with holes. + This results in sparse files, independent of whether the archive format +--- libarchive-3.1.2/libarchive/archive_write_disk_posix.c.orig ++++ libarchive-3.1.2/libarchive/archive_write_disk_posix.c +@@ -2504,8 +2504,9 @@ + /* + * 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. ++ * error for an empty path, a trailing '..', (if _SECURE_NODOTDOT is ++ * set) any '..' in the path or (if ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS ++ * is set) if the path is absolute. + */ + static int + cleanup_pathname(struct archive_write_disk *a) +@@ -2524,8 +2525,15 @@ + cleanup_pathname_win(a); + #endif + /* Skip leading '/'. */ +- if (*src == '/') ++ if (*src == '/') { ++ if (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) { ++ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ++ "Path is absolute"); ++ return (ARCHIVE_FAILED); ++ } ++ + separator = *src++; ++ } + + /* Scan the pathname one element at a time. */ + for (;;) { +--- libarchive-3.1.2/libarchive/test/test_write_disk_secure.c.orig ++++ libarchive-3.1.2/libarchive/test/test_write_disk_secure.c +@@ -178,6 +178,29 @@ + assert(S_ISDIR(st.st_mode)); + archive_entry_free(ae); + ++ /* ++ * Without security checks, we should be able to ++ * extract an absolute path. ++ */ ++ assert((ae = archive_entry_new()) != NULL); ++ archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); ++ archive_entry_set_mode(ae, S_IFREG | 0777); ++ assert(0 == archive_write_header(a, ae)); ++ assert(0 == archive_write_finish_entry(a)); ++ assertFileExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); ++ assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp")); ++ ++ /* But with security checks enabled, this should fail. */ ++ assert(archive_entry_clear(ae) != NULL); ++ archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); ++ archive_entry_set_mode(ae, S_IFREG | 0777); ++ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS); ++ failure("Extracting an absolute path should fail here."); ++ assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); ++ archive_entry_free(ae); ++ assert(0 == archive_write_finish_entry(a)); ++ assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); ++ + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Test the entries on disk. */ +--- libarchive-3.1.2/libarchive/archive_write.c.orig 2016-06-03 13:15:42.862830537 +0000 ++++ libarchive-3.1.2/libarchive/archive_write.c 2016-06-03 13:19:01.590826126 +0000 +@@ -671,8 +671,12 @@ + _archive_write_data(struct archive *_a, const void *buff, size_t s) + { + struct archive_write *a = (struct archive_write *)_a; ++ const size_t max_write = INT_MAX; + archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, + ARCHIVE_STATE_DATA, "archive_write_data"); ++ /* In particular, this catches attempts to pass negative values. */ ++ if (s > max_write) ++ s = max_write; + archive_clear_error(&a->archive); + return ((a->format_write_data)(a, buff, s)); + } -- cgit v1.2.3