summaryrefslogtreecommitdiff
path: root/ufs-fsck
diff options
context:
space:
mode:
Diffstat (limited to 'ufs-fsck')
-rw-r--r--ufs-fsck/ChangeLog8
-rw-r--r--ufs-fsck/dir.c2
-rw-r--r--ufs-fsck/pass2.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/ufs-fsck/ChangeLog b/ufs-fsck/ChangeLog
index 615e6458..c8def0d7 100644
--- a/ufs-fsck/ChangeLog
+++ b/ufs-fsck/ChangeLog
@@ -1,3 +1,11 @@
+Fri Aug 16 10:25:37 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
+
+ * dir.c (record_directory): Maximum number of block pointers to
+ record is NDADDR + NIADDR, not NDADDR * NIADDR.
+ * pass2.c: Include <assert.h>.
+ (pass2): Before copying block addresses to DINO in basic
+ integrity check, assert that DNP->i_numblks isn't too big.
+
Mon Aug 12 11:39:12 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* Makefile (dir): Now ufs-fsck.
diff --git a/ufs-fsck/dir.c b/ufs-fsck/dir.c
index d4f05858..b058fe9e 100644
--- a/ufs-fsck/dir.c
+++ b/ufs-fsck/dir.c
@@ -31,7 +31,7 @@ record_directory (struct dinode *dp, ino_t number)
blks = howmany (dp->di_size, sblock->fs_bsize);
if (blks > NDADDR)
- blks = NDADDR * NIADDR;
+ blks = NDADDR + NIADDR;
blks *= sizeof (daddr_t);
dnp = malloc (sizeof (struct dirinfo) + blks);
diff --git a/ufs-fsck/pass2.c b/ufs-fsck/pass2.c
index db63abd7..a2d5996c 100644
--- a/ufs-fsck/pass2.c
+++ b/ufs-fsck/pass2.c
@@ -19,6 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "fsck.h"
+#include <assert.h>
/* Verify root inode's allocation and check all directories for
viability. Set DIRSORTED array fully and check to make sure
@@ -307,6 +308,7 @@ pass2 ()
}
bzero (&dino, sizeof (struct dinode));
dino.di_size = dnp->i_isize;
+ assert (dnp->i_numblks <= (NDADDR + NIADDR) * sizeof (daddr_t));
bcopy (dnp->i_blks, dino.di_db, dnp->i_numblks);
datablocks_iterate (&dino, checkdirblock);