git: 58135fbd8b68 - main - gzip: fix error handling in unxz
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Feb 2022 15:31:09 UTC
The branch main has been updated by vangyzen:
URL: https://cgit.FreeBSD.org/src/commit/?id=58135fbd8b68228678eb0ce38566aaf7ab1aad94
commit 58135fbd8b68228678eb0ce38566aaf7ab1aad94
Author: Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2022-02-24 23:00:52 +0000
Commit: Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2022-02-25 15:30:29 +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
---
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;
}