summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-05-03 22:03:50 +0000
committerMiles Bader <miles@gnu.org>1995-05-03 22:03:50 +0000
commit6beba1e5de2cabdeb45bb7c3ea5fd8e532508275 (patch)
treeeb2e6061536ea4abe1dfecb5272315aac9871bd2 /ext2fs
parent661c02ae8420eeeadc32b3a7bf1e99afa777ef80 (diff)
Formerly dir.c.~10~
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/dir.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index afdd23dc..cbb58d91 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -2,6 +2,8 @@
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+ Converted for ext2fs by Miles Bader <miles@gnu.ai.mit.edu>
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
@@ -870,12 +872,29 @@ diskfs_get_directs (struct node *dp,
i++;
}
+ if (entryp->rec_len == 0)
+ {
+ ext2_warning ("diskfs_get_directs",
+ "Zero length directory entry: inode: %d offset: %ld",
+ dp->dn->number,
+ blkno * DIRBLKSIZ + bufp - buf);
+ return EIO;
+ }
+
bufp += entryp->rec_len;
if (bufp - buf == DIRBLKSIZ)
{
blkno++;
bufvalid = 0;
}
+ else if (bufp - buf > DIRBLKSIZ)
+ {
+ ext2_warning ("diskfs_get_directs",
+ "Directory entry too long: inode: %d offset: %ld",
+ dp->dn->number,
+ blkno * DIRBLKSIZ + bufp - buf - entryp->rec_len);
+ return EIO;
+ }
}
/* We've copied all we can. If we allocated our own array