3d071d
From 7180c1ad36a1f419e20e90ddfad0b2f77d8c018f Mon Sep 17 00:00:00 2001
3d071d
From: Karel Zak <kzak@redhat.com>
3d071d
Date: Thu, 2 Jun 2022 16:02:54 +0200
3d071d
Subject: libblkid: (mac) make sure block size is large enough [fuzzing]
3d071d
3d071d
Upstream: http://github.com/util-linux/util-linux/commit/4e12fbca62be10b09503cecc7507757874043474
3d071d
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030
3d071d
Reported-by: Thibault Guittet <tguittet@redhat.com>
3d071d
Signed-off-by: Karel Zak <kzak@redhat.com>
3d071d
---
3d071d
 libblkid/src/partitions/mac.c | 2 ++
3d071d
 1 file changed, 2 insertions(+)
3d071d
3d071d
diff --git a/libblkid/src/partitions/mac.c b/libblkid/src/partitions/mac.c
3d071d
index 092d31d32..75a558b0a 100644
3d071d
--- a/libblkid/src/partitions/mac.c
3d071d
+++ b/libblkid/src/partitions/mac.c
3d071d
@@ -93,6 +93,8 @@ static int probe_mac_pt(blkid_probe pr,
3d071d
 	}
3d071d
 
3d071d
 	block_size = be16_to_cpu(md->block_size);
3d071d
+	if (block_size < sizeof(struct mac_partition))
3d071d
+		goto nothing;
3d071d
 
3d071d
 	/* The partition map always begins at physical block 1,
3d071d
 	 * the second block on the disk.
3d071d
-- 
3d071d
2.36.1
3d071d