From 1a73b23e30cb62554d85d3bc85261b30d5bd7b27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 19 Nov 2022 20:37:50 +0100 Subject: [PATCH] libblkid: exfat: validate more fields --- libblkid/src/superblocks/exfat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libblkid/src/superblocks/exfat.c b/libblkid/src/superblocks/exfat.c index 003c08f6f4..c07054ac43 100644 --- a/libblkid/src/superblocks/exfat.c +++ b/libblkid/src/superblocks/exfat.c @@ -167,6 +167,16 @@ static int probe_exfat(blkid_probe pr, const struct blkid_idmag *mag) if (!sb || !CLUSTER_SIZE(sb)) return errno ? -errno : BLKID_PROBE_NONE; + if (le16_to_cpu(sb->BootSignature) != 0xAA55) + return BLKID_PROBE_NONE; + + if (memcmp(sb->JumpBoot, "\xEB\x76\x90", 3) != 0) + return BLKID_PROBE_NONE; + + for (size_t i = 0; i < sizeof(sb->MustBeZero); i++) + if (sb->MustBeZero[i] != 0x00) + return BLKID_PROBE_NONE; + if (!exfat_validate_checksum(pr, sb)) return BLKID_PROBE_NONE; -- 2.47.2