From ee3d6b0d4a61c3dbf68929db1b2e8ceda872fb58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 5 Jul 2021 15:10:51 +0200 Subject: [PATCH] libblkid: vfat: Fix reading FAT32 boot label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FAT32 can be formatted with boot sign 0x28 to indicate that only serial id is present or with boot sign 0x29 which indicates that both boot label and serial id is present. Signed-off-by: Pali Rohár --- libblkid/src/superblocks/vfat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libblkid/src/superblocks/vfat.c b/libblkid/src/superblocks/vfat.c index 72e9b78c6..71813485a 100644 --- a/libblkid/src/superblocks/vfat.c +++ b/libblkid/src/superblocks/vfat.c @@ -43,7 +43,9 @@ struct vfat_super_block { /* 30*/ uint16_t vs_fsinfo_sector; /* 32*/ uint16_t vs_backup_boot; /* 34*/ uint16_t vs_reserved2[6]; -/* 40*/ unsigned char vs_unknown[3]; +/* 40*/ unsigned char vs_drive_number; +/* 41*/ unsigned char vs_boot_flags; +/* 42*/ unsigned char vs_ext_boot_sign; /* 0x28 - without vs_label/vs_magic; 0x29 - with */ /* 43*/ unsigned char vs_serno[4]; /* 47*/ unsigned char vs_label[11]; /* 52*/ unsigned char vs_magic[8]; @@ -387,7 +389,9 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) version = "FAT32"; - boot_label = vs->vs_label; + if (vs->vs_ext_boot_sign == 0x29) + boot_label = vs->vs_label; + vol_serno = vs->vs_serno; /*