From: Tim Kientzle Date: Sat, 14 May 2016 19:37:37 +0000 (-0700) Subject: Reject cpio symlinks that exceed 1MB X-Git-Tag: v3.2.1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd7e0c02e272913a0a8b6d492c7260dfca0b1408;p=thirdparty%2Flibarchive.git Reject cpio symlinks that exceed 1MB --- diff --git a/libarchive/archive_read_support_format_cpio.c b/libarchive/archive_read_support_format_cpio.c index c2ca85bd3..b09db0e9a 100644 --- a/libarchive/archive_read_support_format_cpio.c +++ b/libarchive/archive_read_support_format_cpio.c @@ -401,6 +401,11 @@ archive_read_format_cpio_read_header(struct archive_read *a, /* If this is a symlink, read the link contents. */ if (archive_entry_filetype(entry) == AE_IFLNK) { + if (cpio->entry_bytes_remaining > 1024 * 1024) { + archive_set_error(&a->archive, ENOMEM, + "Rejecting malformed cpio archive: symlink contents exceed 1 megabyte"); + return (ARCHIVE_FATAL); + } h = __archive_read_ahead(a, (size_t)cpio->entry_bytes_remaining, NULL); if (h == NULL)