diff --git a/src/buffer.c b/src/buffer.c index 57fe813a..6f96c2fa 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -402,10 +402,12 @@ check_compressed_archive (bool *pshort) /* Restore global values */ read_full_records = sfr; - if ((strcmp (record_start->header.magic, TMAGIC) == 0 || - strcmp (record_start->buffer + offsetof (struct posix_header, magic), - OLDGNU_MAGIC) == 0) && - tar_checksum (record_start, true) == HEADER_SUCCESS) + if (record_start != record_end /* no files smaller than BLOCKSIZE */ + && (strcmp (record_start->header.magic, TMAGIC) == 0 + || strcmp (record_start->buffer + offsetof (struct posix_header, + magic), + OLDGNU_MAGIC) == 0) + && tar_checksum (record_start, true) == HEADER_SUCCESS) /* Probably a valid header */ return ct_tar;