File fix-extract-over-links.patch of Package libarchive
--- a/libarchive/archive_write_disk_posix.c.orig 2016-12-02 13:13:57.433550535 +0000
+++ a/libarchive/archive_write_disk_posix.c 2016-12-02 13:16:36.770020356 +0000
@@ -2051,12 +2051,14 @@ create_filesystem_object(struct archive_
/* EPERM is more appropriate than error_number for our callers */
return (EPERM);
}
- r = check_symlinks_fsobj(linkname_copy, &error_number, &error_string, a->flags);
- if (r != ARCHIVE_OK) {
- archive_set_error(&a->archive, error_number, "%s", error_string.s);
- free(linkname_copy);
- /* EPERM is more appropriate than error_number for our callers */
- return (EPERM);
+ if (a->flags & ARCHIVE_EXTRACT_SECURE_SYMLINKS) {
+ r = check_symlinks_fsobj(linkname_copy, &error_number, &error_string, a->flags);
+ if (r != ARCHIVE_OK) {
+ archive_set_error(&a->archive, error_number, "%s", error_string.s);
+ free(linkname_copy);
+ /* EPERM is more appropriate than error_number for our callers */
+ return (EPERM);
+ }
}
free(linkname_copy);
r = link(linkname, a->name) ? errno : 0;