Bugfix --sparse --diff mode

Originally reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=1853469

* src/sparse.c (check_data_region): Only compare the part of buffer
really fed by safe_read(), not whole rdsize.
This commit is contained in:
Pavel Raiskup
2020-07-09 21:22:10 +02:00
committed by Sergey Poznyakoff
parent 1ff0b63f48
commit 1263f9bc1d

View File

@@ -684,7 +684,7 @@ check_data_region (struct tar_sparse_file *file, size_t i)
}
size_left -= bytes_read;
mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
if (memcmp (blk->buffer, diff_buffer, rdsize))
if (memcmp (blk->buffer, diff_buffer, bytes_read))
{
report_difference (file->stat_info, _("Contents differ"));
return false;