Skip to contentSkip to conversation

fsck.f2fs: fix cur_valid_map buffer overflow

PATCH New Jin Qian 1 participant 1 message Apr 18, 2017

lore
Share & tools
lore

Jin Qian

author
#0 lore raw

PATCH 1/1 fsck.f2fs: fix cur_valid_map buffer overflow

blk_off is read from image. Attacker can construct an image with big blk_off that trigger overflow on se->cur_valid_map.

---
 fsck/fsck.c | 2 ++
 1 file changed, 2 insertions(+)
fsck/fsck.c +2 -0
index b625153..e97ee0a 100644
@@ -1825,6 +1825,8 @@ int check_curseg_offset(struct f2fs_sb_info *sbi)
 		struct seg_entry *se;
 		int j, nblocks;
 
+		if ((curseg->next_blkoff >> 3) >= SIT_VBLOCK_MAP_SIZE)
+			return -EINVAL;
 		se = get_seg_entry(sbi, curseg->segno);
 		if (f2fs_test_bit(curseg->next_blkoff,
 					(const char *)se->cur_valid_map)) {
Signature · 6 lines
2.12.2.762.g0e3151a226-goog


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot