diff options
author | kientzle <kientzle@FreeBSD.org> | 2006-11-13 16:50:18 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2006-11-13 16:50:18 +0000 |
commit | b3076e31d7a81d25fcc8b3e04d986eed3238bb1d (patch) | |
tree | 0ade7825bf05abc2b7665a7956a8517eb796dc78 /lib/libarchive/archive_read_support_format_tar.c | |
parent | 8ee020ccf79e02e705343e94c03256feaee14e8e (diff) | |
download | FreeBSD-src-b3076e31d7a81d25fcc8b3e04d986eed3238bb1d.zip FreeBSD-src-b3076e31d7a81d25fcc8b3e04d986eed3238bb1d.tar.gz |
No change in functionality, but fill in a missing error
message when reading a truncated tar archive.
Diffstat (limited to 'lib/libarchive/archive_read_support_format_tar.c')
-rw-r--r-- | lib/libarchive/archive_read_support_format_tar.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libarchive/archive_read_support_format_tar.c b/lib/libarchive/archive_read_support_format_tar.c index 3d3a04a..5ad9f1c 100644 --- a/lib/libarchive/archive_read_support_format_tar.c +++ b/lib/libarchive/archive_read_support_format_tar.c @@ -497,7 +497,12 @@ archive_read_format_tar_read_data(struct archive *a, if (tar->entry_bytes_remaining > 0) { bytes_read = (a->compression_read_ahead)(a, buff, 1); - if (bytes_read <= 0) + if (bytes_read == 0) { + archive_set_error(a, ARCHIVE_ERRNO_MISC, + "Truncated tar archive"); + return (ARCHIVE_FATAL); + } + if (bytes_read < 0) return (ARCHIVE_FATAL); if (bytes_read > tar->entry_bytes_remaining) bytes_read = tar->entry_bytes_remaining; |