summaryrefslogtreecommitdiff
path: root/e2fsck/pass2.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1999-10-25 21:03:34 +0000
committerTheodore Ts'o <tytso@mit.edu>1999-10-25 21:03:34 +0000
commitc40db6d5717023bdd6bb4935161e7ce9678d6234 (patch)
tree03be065b72e31935fd1a3d2981943ee978b486bb /e2fsck/pass2.c
parentbac43be999ec23b5c4a2f958a9423dacba3419b6 (diff)
downloade2fsprogs-c40db6d5717023bdd6bb4935161e7ce9678d6234.tar.gz
ChangeLog, pass2.c, problem.c, problem.h:
problem.c, problem.h (PR_2_NULL_NAME): Add new problem code. pass2.c (check_dir_block): Require that the length of the directory entry be at least 12 bytes. Check to see if the filename is zero-length, and flag that as an error.
Diffstat (limited to 'e2fsck/pass2.c')
-rw-r--r--e2fsck/pass2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index f41cdfef..e6a434cb 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -406,7 +406,7 @@ static int check_dir_block(ext2_filsys fs,
cd->pctx.dirent = dirent;
cd->pctx.num = offset;
if (((offset + dirent->rec_len) > fs->blocksize) ||
- (dirent->rec_len < 8) ||
+ (dirent->rec_len < 12) ||
((dirent->rec_len % 4) != 0) ||
(((dirent->name_len & 0xFF)+8) > dirent->rec_len)) {
if (fix_problem(ctx, PR_2_DIR_CORRUPTED, &cd->pctx)) {
@@ -496,6 +496,12 @@ static int check_dir_block(ext2_filsys fs,
* directory hasn't been created yet.
*/
problem = PR_2_LINK_ROOT;
+ } else if ((dot_state > 2) &&
+ (dirent->name_len & 0xFF) == 0) {
+ /*
+ * Don't allow zero-length directory names.
+ */
+ problem = PR_2_NULL_NAME;
}
if (problem) {