From 5166c9b1c3bfa2b58371a4859efffb32e9c062a5 Mon Sep 17 00:00:00 2001 From: Lawrence Rust Date: Mon, 5 Oct 2009 15:42:13 +0200 Subject: [PATCH] libblkid: fix FAT super block definition Signed-off-by: Lawrence Rust Signed-off-by: Karel Zak --- shlibs/blkid/src/probers/vfat.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/shlibs/blkid/src/probers/vfat.c b/shlibs/blkid/src/probers/vfat.c index 99f28709..a70ccd9b 100644 --- a/shlibs/blkid/src/probers/vfat.c +++ b/shlibs/blkid/src/probers/vfat.c @@ -45,8 +45,8 @@ struct vfat_super_block { /* 43*/ unsigned char vs_serno[4]; /* 47*/ unsigned char vs_label[11]; /* 52*/ unsigned char vs_magic[8]; -/* 5a*/ unsigned char vs_dummy2[164]; -/*1fe*/ unsigned char vs_pmagic[2]; +/* 5a*/ unsigned char vs_dummy2[0x1fe - 0x5a]; +/*1fe*/ unsigned char vs_pmagic[2]; } __attribute__((packed)); /* Yucky misaligned values */ @@ -69,8 +69,8 @@ struct msdos_super_block { /* 27*/ unsigned char ms_serno[4]; /* 2b*/ unsigned char ms_label[11]; /* 36*/ unsigned char ms_magic[8]; -/* 3d*/ unsigned char ms_dummy2[192]; -/*1fe*/ unsigned char ms_pmagic[2]; +/* 3e*/ unsigned char ms_dummy2[0x1fe - 0x3e]; +/*1fe*/ unsigned char ms_pmagic[2]; } __attribute__((packed)); struct vfat_dir_entry { @@ -143,6 +143,9 @@ static int probe_fat_nomagic(blkid_probe pr, const struct blkid_idmag *mag) if (!ms) return -1; + if (ms->ms_pmagic[0] != 0x55 || ms->ms_pmagic[1] != 0xAA) + return 1; + /* heads check */ if (ms->ms_heads == 0) return 1; -- 2.39.5