]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: exfat: validate more fields
authorThomas Weißschuh <thomas@t-8ch.de>
Sat, 19 Nov 2022 19:37:50 +0000 (20:37 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 20 Nov 2022 21:47:46 +0000 (22:47 +0100)
libblkid/src/superblocks/exfat.c

index 003c08f6f4f147597002f129365707af41aeddd6..c07054ac433aee25103c848e4ac2a2472daedfe9 100644 (file)
@@ -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;