⬢ DragonFlyBSD Kernel Audit
DF-3154 / fix.diff
← back to finding ↓ download raw
--- a/sys/vfs/ext2fs/ext2_csum.c
+++ b/sys/vfs/ext2fs/ext2_csum.c
@@ -586,7 +586,8 @@
 		 * it is expected that it will be zeroed
 		 * and we will not return checksum error in this case.
 		 */
-		if (!memcmp(ei, &ei_zero, sizeof(struct ext2fs_dinode)))
+		if (!memcmp(ei, &ei_zero,
+		    imin(EXT2_INODE_SIZE(fs), sizeof(struct ext2fs_dinode))))
 			return (0);
 
 		SDT_PROBE2(ext2fs, , trace, csum, 1, "bad inode csum");