]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
archive_match: check archive_read_support_format_raw() return value (#2153)
authorTobias Stoeckmann <stoeckmann@users.noreply.github.com>
Mon, 29 Apr 2024 20:00:22 +0000 (22:00 +0200)
committerGitHub <noreply@github.com>
Mon, 29 Apr 2024 20:00:22 +0000 (22:00 +0200)
If call of archive_read_support_format_raw fails, do not override the
error return value with the return value of
archive_read_support_format_empty(). Instead, return error code as expected.

libarchive/archive_match.c

index fc8a4ce8127bafc0d5efc66ed41e7098376fb937..b108ff0a7347dbb2a1a8bf4ffa35136d3e6d677d 100644 (file)
@@ -605,7 +605,8 @@ add_pattern_from_file(struct archive_match *a, struct match_list *mlist,
                return (ARCHIVE_FATAL);
        }
        r = archive_read_support_format_raw(ar);
-       r = archive_read_support_format_empty(ar);
+       if (r == ARCHIVE_OK)
+               r = archive_read_support_format_empty(ar);
        if (r != ARCHIVE_OK) {
                archive_copy_error(&(a->archive), ar);
                archive_read_free(ar);