dcavalca / rpms / util-linux

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