]> err.no Git - util-linux/commitdiff
libblkid: fix FAT super block definition
authorLawrence Rust <lawrence@softsystem.co.uk>
Mon, 5 Oct 2009 13:42:13 +0000 (15:42 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 30 Nov 2009 13:21:08 +0000 (14:21 +0100)
Signed-off-by: Lawrence Rust <lawrence@softsystem.co.uk>
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/probers/vfat.c

index 99f287091aeea21481c6077b255cff6c880199c6..a70ccd9bff3d89117bd1f89a9c597843e2f0f4c2 100644 (file)
@@ -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;