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)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to