Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Mar 2022 21:57:38 GMT
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9bee45e9151e - stable/13 - gzip: fix error handling in unxz
Message-ID:  <202203022157.222Lvchv065491@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by vangyzen:

URL: https://cgit.FreeBSD.org/src/commit/?id=9bee45e9151e8718380257e690316488d347c065

commit 9bee45e9151e8718380257e690316488d347c065
Author:     Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2022-02-24 23:00:52 +0000
Commit:     Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2022-03-02 21:56:31 +0000

    gzip: fix error handling in unxz
    
    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 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/usr.bin/gzip/unxz.c b/usr.bin/gzip/unxz.c
index b92bec8f39b0..246600fd657c 100644
--- a/usr.bin/gzip/unxz.c
+++ b/usr.bin/gzip/unxz.c
@@ -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;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203022157.222Lvchv065491>