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.
+1999-10-25 <tytso@valinux.com>
+
+ * 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.
+
1999-10-22 <tytso@valinux.com>
* Release of E2fsprogs 1.16
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)) {
* 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) {
"@E has filetype set\n",
PROMPT_CLEAR, PR_PREEN_OK },
+ /* Directory filename is null */
+ { PR_2_NULL_NAME,
+ "@E has a zero-length name\n",
+ PROMPT_CLEAR, 0 },
+
/* Pass 3 errors */
/* Pass 3: Checking directory connectivity */
/* Directory filetype set when it shouldn't be */
#define PR_2_CLEAR_FILETYPE 0x020029
+/* Directory filename can't be zero-length */
+#define PR_2_NULL_NAME 0x020030
+
/*
* Pass 3 errors
*/