From 7ebfe9b411c12223a2500ca62d6be37c48e2d83d Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 2 Jun 2022 16:02:54 +0200
Subject: [PATCH] libblkid: (hfs) fix make sure buffer is large enough

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 libblkid/src/superblocks/ntfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libblkid/src/superblocks/ntfs.c b/libblkid/src/superblocks/ntfs.c
index 9f1927cf74..b5799c3e33 100644
--- a/libblkid/src/superblocks/ntfs.c
+++ b/libblkid/src/superblocks/ntfs.c
@@ -158,6 +158,9 @@ static int __probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag, int save_
 			sectors_per_cluster, nr_clusters,
 			off));
 
+	if (mft_record_size < 4)
+		return 1;
+
 	buf_mft = blkid_probe_get_buffer(pr, off, mft_record_size);
 	if (!buf_mft)
 		return errno ? -errno : 1;
