Read NTFS extra field only if all (modify, access, creation) timestamps are present.

This commit is contained in:
juanii 2018-02-11 13:56:21 -03:00
parent 3679a3dcdc
commit 7063b0e2e9

View File

@ -770,17 +770,17 @@ static int32_t mz_zip_entry_read_header(void *stream, uint8_t local, mz_zip_file
if (err == MZ_OK)
err = mz_stream_read_uint16(file_info_stream, &ntfs_attrib_size);
if (ntfs_attrib_id == 0x01 && ntfs_attrib_size >= 8)
if (ntfs_attrib_id == 0x01 && ntfs_attrib_size == 24)
{
err = mz_stream_read_uint64(file_info_stream, &ntfs_time);
mz_zip_ntfs_to_unix_time(ntfs_time, &file_info->modified_date);
if ((err == MZ_OK) && (ntfs_attrib_size >= 16))
if (err == MZ_OK)
{
err = mz_stream_read_uint64(file_info_stream, &ntfs_time);
mz_zip_ntfs_to_unix_time(ntfs_time, &file_info->accessed_date);
}
if ((err == MZ_OK) && (ntfs_attrib_size >= 24))
if (err == MZ_OK)
{
err = mz_stream_read_uint64(file_info_stream, &ntfs_time);
mz_zip_ntfs_to_unix_time(ntfs_time, &file_info->creation_date);