From nobody Wed Mar 02 21:57:38 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E6D5619E0E2B; Wed, 2 Mar 2022 21:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K87Jh5nTzz3KYL; Wed, 2 Mar 2022 21:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XlBA54cEhCsee7WRkF79DlSqcmO0udMmLoMnlwDgZTk=; b=o/rHL40PBMkty8GsFTKzwaJa95JthmbtaZxK40XvohXq4cAc0Nugh4R7FWJC2TnRtuk0ya TqaNQthIIbKD2gH/qxCiAB5jXwy+U2GcbJXsNk7jY3z1h6IcqNXSvksYsIDqR8H+TYj0lW NlgNcm5FiIl4HqfDCIOEI9kDmtmfw3/GSIuvMA5voBzlsrHT8wmSsrAE2SavPTr2zd0b1u sYhzwtzmGRRthzwgAlUEM0iDRChuAoOWQfyzrgjntmxFPPsqKv+X6Kr0YoXpadDqaYC+3L SexSRMYKEP1y8+vrVT0sCWXE+40d/IIQDf6rTt0Sveg4vp/rKUOxXhxwBQRzzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3CEB3A8E; Wed, 2 Mar 2022 21:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 222Lvco0065492; Wed, 2 Mar 2022 21:57:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 222Lvchv065491; Wed, 2 Mar 2022 21:57:38 GMT (envelope-from git) Date: Wed, 2 Mar 2022 21:57:38 GMT Message-Id: <202203022157.222Lvchv065491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric van Gyzen Subject: git: 9bee45e9151e - stable/13 - gzip: fix error handling in unxz List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9bee45e9151e8718380257e690316488d347c065 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XlBA54cEhCsee7WRkF79DlSqcmO0udMmLoMnlwDgZTk=; b=vL53HA+EFS4fhtbfDzF1Ok475iubEtmTxCN+s+sORlNIOT1LY768AF2GBS5Zzj7gzUBLvD JCAtW2SIuLXL0RSNrRnPlLboRK9iE8XgMaOFBmsElwhJnlsiXfSis50GhvgLO/5Cr89GlI V7JHufFMdBrzoUWVBjAAMiJiY8F7dEOIaJ4PPosKsklyDRB16S4X1qp8ZpOSZShXqyOEHw Wb+KkP8I45qBL6X1QRUUaBy43Mw20z1e4HLQ64tym3Y22Brtq1AcugRq5IvgIL11ABAz5p as6Yo5puImTRPAa5KPzCwX7/ee4uTuDxV/QM3bcXQu80l9se5vXfljj4hSJX3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646258260; a=rsa-sha256; cv=none; b=M3NKiImkuxBPJ2fpHRbf44j4+4naIs/MiRRqvP+U/bP9QBClYO9ZES2eAQ+rZ58sfN+7Tr AHOPFe+oPkSvroDCjs8nc9WJhxzrGijD7mpClHvOec6fXKPU7xLYnqMIVdokcQSA6cvN5H tfmUbcHRwMV4Xs6uzookyJbqsaY6ZMsg+C14/psWa/kaNWag/Tpjg8J6S7a73amdZVIkPo NkQ2irFaVD1OffokgbtnHdaMReEE9UHs1x+NlFxBs1WiRvpbmL7PkJXeD32WxXR/APkj0N mc9o4PqGszs7A9ey5uB64dEybcDMQcbsWUyAH3Ln+rtFZWLmp0ayNkm1rqqH3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=9bee45e9151e8718380257e690316488d347c065 commit 9bee45e9151e8718380257e690316488d347c065 Author: Eric van Gyzen AuthorDate: 2022-02-24 23:00:52 +0000 Commit: Eric van Gyzen 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; }