Skip to content

Commit

Permalink
Reject cpio symlinks that exceed 1MB
Browse files Browse the repository at this point in the history
  • Loading branch information
kientzle committed May 14, 2016
1 parent f48d99b commit fd7e0c0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libarchive/archive_read_support_format_cpio.c
Expand Up @@ -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)
Expand Down

0 comments on commit fd7e0c0

Please sign in to comment.