ChangeLog, message.c, pass2.c, pass3.c:
Mask off the high eight bits of the directory entry's name_len field,
so that it can be used for other purposes.
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 95cf80d..0d0ef86 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,11 @@
+Sun Mar 8 23:08:08 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * pass3.c (fix_dotdot_proc):
+ * pass2.c (check_dot, check_dotdot, check_name, check_dir_block):
+ * message.c (expand_dirent_expression): Mask off the high eight
+ bits of the directory entry's name_len field, so that it
+ can be used for other purposes.
+
Fri Feb 27 00:01:39 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
* e2fsck.c (e2fsck_run): Since E2F_FLAG_SIGNAL_MASK doesn't
diff --git a/e2fsck/message.c b/e2fsck/message.c
index c464131..82cb423 100644
--- a/e2fsck/message.c
+++ b/e2fsck/message.c
@@ -248,18 +248,18 @@
printf("%u", dirent->inode);
break;
case 'n':
- len = dirent->name_len;
+ len = dirent->name_len & 0xFF;
if (len > EXT2_NAME_LEN)
len = EXT2_NAME_LEN;
if (len > dirent->rec_len)
len = dirent->rec_len;
- printf("%.*s", dirent->name_len, dirent->name);
+ printf("%.*s", len, dirent->name);
break;
case 'r':
printf("%u", dirent->rec_len);
break;
case 'l':
- printf("%u", dirent->name_len);
+ printf("%u", dirent->name_len & 0xFF);
break;
default:
no_dirent:
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 1507a97..52db68f 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -154,7 +154,7 @@
if (!dirent->inode)
problem = PR_2_MISSING_DOT;
- else if ((dirent->name_len != 1) ||
+ else if (((dirent->name_len & 0xFF) != 1) ||
(dirent->name[0] != '.'))
problem = PR_2_1ST_NOT_DOT;
else if (dirent->name[1] != '\0')
@@ -209,7 +209,7 @@
if (!dirent->inode)
problem = PR_2_MISSING_DOT_DOT;
- else if ((dirent->name_len != 2) ||
+ else if (((dirent->name_len & 0xFF) != 2) ||
(dirent->name[0] != '.') ||
(dirent->name[1] != '.'))
problem = PR_2_2ND_NOT_DOT_DOT;
@@ -250,7 +250,7 @@
int fixup = -1;
int ret = 0;
- for ( i = 0; i < dirent->name_len; i++) {
+ for ( i = 0; i < (dirent->name_len & 0xFF); i++) {
if (dirent->name[i] == '/' || dirent->name[i] == '\0') {
if (fixup < 0) {
fixup = fix_problem(ctx, PR_2_BAD_NAME, pctx);
@@ -337,7 +337,7 @@
if (((offset + dirent->rec_len) > fs->blocksize) ||
(dirent->rec_len < 8) ||
((dirent->rec_len % 4) != 0) ||
- ((dirent->name_len+8) > dirent->rec_len)) {
+ (((dirent->name_len & 0xFF)+8) > dirent->rec_len)) {
if (fix_problem(ctx, PR_2_DIR_CORRUPTED, &cd->pctx)) {
dirent->rec_len = fs->blocksize - offset;
dirent->name_len = 0;
@@ -346,7 +346,7 @@
} else
return DIRENT_ABORT;
}
- if (dirent->name_len > EXT2_NAME_LEN) {
+ if ((dirent->name_len & 0xFF) > EXT2_NAME_LEN) {
if (fix_problem(ctx, PR_2_FILENAME_LONG, &cd->pctx)) {
dirent->name_len = EXT2_NAME_LEN;
dir_modified++;
@@ -398,7 +398,7 @@
*/
problem = PR_2_BB_INODE;
} else if ((dot_state > 2) &&
- (dirent->name_len == 1) &&
+ ((dirent->name_len & 0xFF) == 1) &&
(dirent->name[0] == '.')) {
/*
* If there's a '.' entry in anything other
@@ -407,7 +407,7 @@
*/
problem = PR_2_DUP_DOT;
} else if ((dot_state > 2) &&
- (dirent->name_len == 2) &&
+ ((dirent->name_len & 0xFF) == 2) &&
(dirent->name[0] == '.') &&
(dirent->name[1] == '.')) {
/*
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 00f081c..733819e 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -542,7 +542,7 @@
errcode_t retval;
struct problem_context pctx;
- if (dirent->name_len != 2)
+ if ((dirent->name_len & 0xFF) != 2)
return 0;
if (strncmp(dirent->name, "..", 2))
return 0;