Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2018 22:23:28 +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-11@freebsd.org
Subject:   svn commit: r329881 - stable/11/sbin/fsck_ffs
Message-ID:  <201802232223.w1NMNSoH010893@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Fri Feb 23 22:23:28 2018
New Revision: 329881
URL: https://svnweb.freebsd.org/changeset/base/329881

Log:
  MFC of 329749.
  
  Fix a read past the end of a buffer in fsck.

Modified:
  stable/11/sbin/fsck_ffs/inode.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/fsck_ffs/inode.c
==============================================================================
--- stable/11/sbin/fsck_ffs/inode.c	Fri Feb 23 21:57:10 2018	(r329880)
+++ stable/11/sbin/fsck_ffs/inode.c	Fri Feb 23 22:23:28 2018	(r329881)
@@ -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?201802232223.w1NMNSoH010893>