Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2018 23:07:41 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
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
Message-ID:  <201802232307.w1NN7fK9031072@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



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