svn commit: r329881 - stable/11/sbin/fsck_ffs

Kirk McKusick mckusick at FreeBSD.org
Fri Feb 23 22:23:29 UTC 2018


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)


More information about the svn-src-all mailing list