]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
cab: Cover all error cases in __archive_read_ahead (#2194)
authorTobias Stoeckmann <stoeckmann@users.noreply.github.com>
Sat, 18 May 2024 04:37:14 +0000 (06:37 +0200)
committerGitHub <noreply@github.com>
Sat, 18 May 2024 04:37:14 +0000 (21:37 -0700)
If a short read is performed, fail with truncation error message as
well.

libarchive/archive_read_support_format_cab.c

index 3b552a84de12c0e04b0e2534a9aa6f6fd867e68f..4ed088d43c4d26c0ad51eed99647d3166f97a301 100644 (file)
@@ -1682,7 +1682,7 @@ cab_read_ahead_cfdata_lzx(struct archive_read *a, ssize_t *avail)
                    cfdata->uncompressed_size - cab->xstrm.total_out;
 
                d = __archive_read_ahead(a, 1, &bytes_avail);
-               if (bytes_avail <= 0) {
+               if (d == NULL) {
                        archive_set_error(&a->archive,
                            ARCHIVE_ERRNO_FILE_FORMAT,
                            "Truncated CAB file data");