Skip to content

Commit

Permalink
Merge pull request data-accelerator#5 from WaberZhuang/master
Browse files Browse the repository at this point in the history
[bugfix] corrected rec_len mistake in expand_dir
  • Loading branch information
liulanzheng authored May 10, 2023
2 parents b4d19a0 + 6723bc7 commit dfc6b00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ext2fs/expanddir.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static errcode_t make_indexed_dir(ext2_filsys fs, ext2_ino_t dir, struct ext2_in
root = (struct ext2_dx_root *) (dx_info.frames[0].buf);
fde = &(root->dotdot);
de = (struct ext2_dir_entry_2 *) ((char *) fde + get_rec_len(fs, fde->rec_len));
if ((char *) de >= (((char *) root) + blocksize))
if ((char *) de > (((char *) root) + blocksize - csum_size))
return EXT2_FILSYS_CORRUPTED;
len = ((char *) root) + (blocksize - csum_size) - (char *) de;
data2 = dx_info.frames[1].buf;
Expand Down Expand Up @@ -269,4 +269,4 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) {
return make_indexed_dir(fs, dir, &inode);

return ext2fs_expand_dir2(fs, dir);
}
}

0 comments on commit dfc6b00

Please sign in to comment.