summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLawrence Rust <lawrence@softsystem.co.uk>2009-10-05 15:42:13 +0200
committerKarel Zak <kzak@redhat.com>2009-11-30 14:21:08 +0100
commit5166c9b1c3bfa2b58371a4859efffb32e9c062a5 (patch)
tree8c3ddda950d6be8c84084bd4d4b5f140c984d9c2
parent3bb52100378944c7c877143e4732940fe3abf250 (diff)
downloadutil-linux-old-5166c9b1c3bfa2b58371a4859efffb32e9c062a5.tar.gz
libblkid: fix FAT super block definition
Signed-off-by: Lawrence Rust <lawrence@softsystem.co.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--shlibs/blkid/src/probers/vfat.c11
1 files 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;