diff --git a/lib/libarchive/archive.h.in b/lib/libarchive/archive.h.in index 149e82dbe43f..ac310e19e16c 100644 --- a/lib/libarchive/archive.h.in +++ b/lib/libarchive/archive.h.in @@ -258,9 +258,11 @@ void archive_read_finish(struct archive *); /*- * To create an archive: * 1) Ask archive_write_new for a archive writer object. - * 2) Set any global properties. In particular, you should register - * open/write/close callbacks. - * 3) Call archive_write_open to open the file + * 2) Set any global properties. In particular, you should set + * the compression and format to use. + * 3) Call archive_write_open to open the file (most people + * will use archive_write_open_file or archive_write_open_fd, + * which provide convenient canned I/O callbacks for you). * 4) For each entry: * - construct an appropriate struct archive_entry structure * - archive_write_header to write the header diff --git a/lib/libarchive/archive_private.h b/lib/libarchive/archive_private.h index 7c03937132cb..97ad6c81a492 100644 --- a/lib/libarchive/archive_private.h +++ b/lib/libarchive/archive_private.h @@ -53,7 +53,7 @@ struct archive { ino_t skip_file_ino; /* Utility: Pointer to a block of nulls. */ - const char *nulls; + const unsigned char *nulls; size_t null_length; /* diff --git a/lib/libarchive/archive_read.c b/lib/libarchive/archive_read.c index 5a1c11450213..a7ed7335fa58 100644 --- a/lib/libarchive/archive_read.c +++ b/lib/libarchive/archive_read.c @@ -55,7 +55,7 @@ struct archive * archive_read_new(void) { struct archive *a; - char *nulls; + unsigned char *nulls; a = malloc(sizeof(*a)); if (a == NULL) { @@ -412,7 +412,7 @@ archive_read_data_skip(struct archive *a) { int r; const void *buff; - ssize_t size; + size_t size; off_t offset; __archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA, "archive_read_data_skip"); diff --git a/lib/libarchive/archive_read_data_into_fd.c b/lib/libarchive/archive_read_data_into_fd.c index 7f2cb6de60b2..9b31d2201857 100644 --- a/lib/libarchive/archive_read_data_into_fd.c +++ b/lib/libarchive/archive_read_data_into_fd.c @@ -45,8 +45,8 @@ archive_read_data_into_fd(struct archive *a, int fd) { int r; const void *buff; - ssize_t size, bytes_to_write; - ssize_t bytes_written, total_written; + size_t size; + ssize_t bytes_to_write, bytes_written, total_written; off_t offset; off_t output_offset; diff --git a/lib/libarchive/archive_read_support_compression_bzip2.c b/lib/libarchive/archive_read_support_compression_bzip2.c index a51d2d45bbce..aa2d531e8b20 100644 --- a/lib/libarchive/archive_read_support_compression_bzip2.c +++ b/lib/libarchive/archive_read_support_compression_bzip2.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #if HAVE_BZLIB_H struct private_data { bz_stream stream; - unsigned char *uncompressed_buffer; + char *uncompressed_buffer; size_t uncompressed_buffer_size; char *read_next; int64_t total_out; diff --git a/lib/libarchive/archive_read_support_format_iso9660.c b/lib/libarchive/archive_read_support_format_iso9660.c index 6a47d7aaba08..33806b9522ef 100644 --- a/lib/libarchive/archive_read_support_format_iso9660.c +++ b/lib/libarchive/archive_read_support_format_iso9660.c @@ -425,6 +425,9 @@ archive_read_format_iso9660_read_data(struct archive *a, } bytes_read = (a->compression_read_ahead)(a, buff, 1); + if (bytes_read == 0) + archive_set_error(a, ARCHIVE_ERRNO_MISC, + "Truncated input file"); if (bytes_read <= 0) return (ARCHIVE_FATAL); if (bytes_read > iso9660->entry_bytes_remaining) @@ -496,7 +499,8 @@ parse_file_info(struct iso9660 *iso9660, struct file_info *parent, const unsigned char *rr_start, *rr_end; rr_end = (const unsigned char *)isodirrec + isodirrec->length[0]; - rr_start = isodirrec->name + isodirrec->name_len[0]; + rr_start = (const unsigned char *)isodirrec->name + + isodirrec->name_len[0]; if ((isodirrec->name_len[0] & 1) == 0) rr_start++; rr_start += iso9660->suspOffset; @@ -669,7 +673,8 @@ parse_rockridge(struct iso9660 *iso9660, struct file_info *file, switch(flag) { case 0x01: /* Continue */ - archive_strncat(&file->symlink, data, nlen); + archive_strncat(&file->symlink, + (const char *)data, nlen); cont = 1; break; case 0x02: /* Current */ @@ -686,7 +691,8 @@ parse_rockridge(struct iso9660 *iso9660, struct file_info *file, archive_strcat(&file->symlink, "hostname"); break; case 0: - archive_strncat(&file->symlink, data, nlen); + archive_strncat(&file->symlink, + (const char *)data, nlen); break; default: /* TODO: issue a warning ? */ diff --git a/lib/libarchive/archive_read_support_format_tar.c b/lib/libarchive/archive_read_support_format_tar.c index c565cecf6699..e854c709ad9b 100644 --- a/lib/libarchive/archive_read_support_format_tar.c +++ b/lib/libarchive/archive_read_support_format_tar.c @@ -1551,7 +1551,7 @@ static int64_t tar_atol256(const char *_p, unsigned char_cnt) { int64_t l, upper_limit, lower_limit; - const unsigned char *p = _p; + const unsigned char *p = (const unsigned char *)_p; upper_limit = max_int64 / 256; lower_limit = min_int64 / 256; diff --git a/lib/libarchive/archive_read_support_format_zip.c b/lib/libarchive/archive_read_support_format_zip.c index d788e868ea9e..2ed0bf696069 100644 --- a/lib/libarchive/archive_read_support_format_zip.c +++ b/lib/libarchive/archive_read_support_format_zip.c @@ -628,7 +628,7 @@ archive_read_format_zip_read_data_skip(struct archive *a) * to decompress all the data to find the end marker. */ if (zip->flags & ZIP_LENGTH_AT_END) { - ssize_t size; + size_t size; off_t offset; int r; do { diff --git a/lib/libarchive/archive_write.c b/lib/libarchive/archive_write.c index 3e87eead2ac7..73283e456c5c 100644 --- a/lib/libarchive/archive_write.c +++ b/lib/libarchive/archive_write.c @@ -56,7 +56,7 @@ struct archive * archive_write_new(void) { struct archive *a; - char *nulls; + unsigned char *nulls; a = malloc(sizeof(*a)); if (a == NULL)