git: 9bee45e9151e - stable/13 - gzip: fix error handling in unxz
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Mar 2022 21:57:38 UTC
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; }