aboutsummaryrefslogtreecommitdiff
path: root/lib/ext2fs/dir_iterate.c
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:10:34 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:10:34 +0000
commit8e8408c65078c4f4c171e5cc2b567d6705bed024 (patch)
tree1605641dff9d3858f2b1595d8885bb0fe9496f34 /lib/ext2fs/dir_iterate.c
parent037a031cb6f2d5e4575a3028e3c7135c59ee805a (diff)
parent63687023fc2e8871a718cb4e18458eece2e3460c (diff)
downloade2fsprogs-8e8408c65078c4f4c171e5cc2b567d6705bed024.tar.gz
Change-Id: Ib8f5c32e208ea07a1c7814b337878a6d47c59923
Diffstat (limited to 'lib/ext2fs/dir_iterate.c')
-rw-r--r--lib/ext2fs/dir_iterate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
index b2b77693..7798a482 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -221,6 +221,10 @@ int ext2fs_process_dir_block(ext2_filsys fs,
if (ext2fs_has_feature_metadata_csum(fs->super))
csum_size = sizeof(struct ext2_dir_entry_tail);
+ if (buflen < 8) {
+ ctx->errcode = EXT2_ET_DIR_CORRUPTED;
+ return BLOCK_ABORT;
+ }
while (offset < buflen - 8) {
dirent = (struct ext2_dir_entry *) (ctx->buf + offset);
if (ext2fs_get_rec_len(fs, dirent, &rec_len))