]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
gzip: fix error handling in unxz
authorEric van Gyzen <vangyzen@FreeBSD.org>
Thu, 24 Feb 2022 23:00:52 +0000 (17:00 -0600)
committerEric van Gyzen <vangyzen@FreeBSD.org>
Wed, 2 Mar 2022 21:56:31 +0000 (15:56 -0600)
The result of fstat() was not checked.  Furthermore, there was a
redundant check of st.st_size.  Fix both.

Reported by:    Coverity
MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 58135fbd8b68228678eb0ce38566aaf7ab1aad94)

usr.bin/gzip/unxz.c

index b92bec8f39b09d2017aa3de36741414bba0b10ba..246600fd657ce4fa1869d2868a9e0626fc949396 100644 (file)
@@ -260,8 +260,7 @@ parse_indexes(xz_file_info *xfi, int src_fd)
 {
        struct stat st;
 
-       fstat(src_fd, &st);
-       if (st.st_size <= 0) {
+       if (fstat(src_fd, &st) != 0) {
                return true;
        }