/* Since we've already done the hard work of finding the
end of central directory record, let's save the important
information. */
- zip->central_directory_entries = archive_le16dec(p + 10);
+ zip->central_directory_entries_on_this_disk = archive_le16dec(p + 8);
+ zip->central_directory_entries_total = archive_le16dec(p + 10);
zip->central_directory_size = archive_le32dec(p + 12);
zip->central_directory_offset = archive_le32dec(p + 16);
- zip->end_of_central_directory_offset = filesize;
-
+ zip->end_of_central_directory_offset = end_of_central_directory_offset;
+
/* Just one volume, so central dir must all be on this volume. */
- if (zip->central_directory_entries != archive_le16dec(p + 8))
+ if (zip->central_directory_entries_total != zip->central_directory_entries_on_this_disk) {
return 0;
- /* Central directory can't extend beyond end of this file. */
+ }
+ /* Central directory can't extend beyond start of EOCD record. */
if (zip->central_directory_offset +
- (int64_t)zip->central_directory_size > filesize)
+ (int64_t)zip->central_directory_size > end_of_central_directory_offset)
return 0;
/* This is just a tiny bit higher than the maximum returned by
test_read_format_xar.c
test_read_format_zip.c
test_read_format_zip_comment_stored.c
+ test_read_format_zip_encryption_data.c
+ test_read_format_zip_encryption_partially.c
+ test_read_format_zip_encryption_header.c
test_read_format_zip_filename.c
test_read_format_zip_mac_metadata.c
+ test_read_format_zip_nofiletype.c
+ test_read_format_zip_padded.c
test_read_format_zip_sfx.c
test_read_large.c
test_read_pax_truncated.c