From owner-svn-src-stable@freebsd.org Fri Feb 23 23:07:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9F81F289C0; Fri, 23 Feb 2018 23:07:41 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98EA67E378; Fri, 23 Feb 2018 23:07:41 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F2351CF37; Fri, 23 Feb 2018 23:07:41 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NN7fVZ031073; Fri, 23 Feb 2018 23:07:41 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NN7fK9031072; Fri, 23 Feb 2018 23:07:41 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802232307.w1NN7fK9031072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 23 Feb 2018 23:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329883 - stable/10/sbin/fsck_ffs X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10/sbin/fsck_ffs X-SVN-Commit-Revision: 329883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:07:42 -0000 Author: mckusick Date: Fri Feb 23 23:07:41 2018 New Revision: 329883 URL: https://svnweb.freebsd.org/changeset/base/329883 Log: MFC of 329749. Fix a read past the end of a buffer in fsck. Modified: stable/10/sbin/fsck_ffs/inode.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_ffs/inode.c ============================================================================== --- stable/10/sbin/fsck_ffs/inode.c Fri Feb 23 22:51:51 2018 (r329882) +++ stable/10/sbin/fsck_ffs/inode.c Fri Feb 23 23:07:41 2018 (r329883) @@ -451,8 +451,10 @@ cacheino(union dinode *dp, ino_t inumber) if (howmany(DIP(dp, di_size), sblock.fs_bsize) > NDADDR) blks = NDADDR + NIADDR; - else + else if (DIP(dp, di_size) > 0) blks = howmany(DIP(dp, di_size), sblock.fs_bsize); + else + blks = 1; inp = (struct inoinfo *) Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); if (inp == NULL)